0

Where is the value stored when the input function is executed.

Where does the value that the user enters gets stored in. I am confused as there is no variable that is mentioned in the statement. Or am I completely wrong and the input statement is something like getch().

10th Jan 2017, 5:06 PM
Athreyan MKS
Athreyan MKS - avatar
2 Answers
+ 2
The input function in Python returns a string. So for example: username = input('Username: ')
10th Jan 2017, 5:08 PM
James Durand
James Durand - avatar
0
Yeah like James said, it does get stored in a variable, in this case the variable is "username". Side note btw, remember that all inputs are by default strings so something like this won't work: number=input("put a number: ") print(number+5) because by default the input is a string, you can't add an integer (5) to a string. if you wanted to correct that, you should write number=int(input("put a number: ")) this will transform whichever number the user put to a number (if it can)
10th Jan 2017, 9:36 PM
ramzi
ramzi - avatar