+ 4
str(12) what is this
the number inside the brackets. is it an index??
3 Answers
+ 5
no it's not index. it's string parameter
+ 4
The number isn't an index, more just a parameter. Whatever you put within the brackets of the str() function will turn into a string, which can be helpful in situations where you need user input. You can also do the same with ints by using the int() function, which turns whatever is in the brackets to an int.
+ 2
Hello.
str() returns whatever is in the brackets as a string.
str(12) returns "12" (that is, a string, not a number)