+ 3
How do you use input()?!
When try to use input() (mostly for numbers) it's say EOFError: EOF when reading line. What am I doing wrong and how can I fix it?
6 Respostas
+ 4
Then change it like this:
a=int(input("Enter a number:"))
print(a)
x=int(input("Enter another number:"))
print(x)
print(x+a)
input is normally a string, you have to change it to an integer.
+ 4
If you have more than one input you have to enter them all at the same time, Separated by an return.
If you have 3 input statements, like in one of your codes enter like this:
Paul
456
I like coding
after that push submit.
+ 3
https://code.sololearn.com/cf3vf64O76XP/?ref=app
This is the code I'm trying to fix
+ 3
It seems you forgot to add the input keyword around the second input variable, resulting in that not prompting for user input.
Also, how the Python input function works is that it takes user input and returns it as a string. When you try to add two strings together, it kind of just mushes them together into one big string, rather than adding them if they were numbers. If you want to get user input as an integer, surround the input function around an int() function, so that it converts the string entered by the user to an int.
+ 3
I finally got it!! 🙋 Thank you guys!
+ 2
EOF stands for End Of File, and is raised whenever the program ends unexpectedly when working with user input. Could you maybe provide a link to your code so that it would be easier to debug?