+ 1

Why can't we put multiple inputs in python

x=0 while x<=4: x=int(input("enter number")) print(x) x=x+1 it only prints value 1 time

26th Feb 2018, 2:23 PM
Darpan
Darpan - avatar
8 ответов
+ 1
x=0 while x<=4: num=int(input()) print(num) x=x+1 now the input variable isn't the same as in the condition of the while loop
26th Feb 2018, 2:36 PM
Alex
Alex - avatar
+ 1
You can, but you did it wrong. Your input overwrites x. You need to give it another name. Or input numbers <=4 and as last input something > 4
26th Feb 2018, 2:30 PM
Alex
Alex - avatar
+ 1
so we have to enter all the five inputs at a time?
26th Feb 2018, 2:43 PM
Darpan
Darpan - avatar
+ 1
thanks buddy...for the help...thats the error i was doing...i was entering just one input at a time🙌👍👍
26th Feb 2018, 2:46 PM
Darpan
Darpan - avatar
0
@Alex can u explain me how will u write the code without overwriting it?
26th Feb 2018, 2:34 PM
Darpan
Darpan - avatar
0
i am getting an EOF error on line 3
26th Feb 2018, 2:38 PM
Darpan
Darpan - avatar
0
https://code.sololearn.com/cqitewD5znRs/?ref=app the inputs need to be in separate lines. I'm not good in Python, since I rarely use it. There surely is a way to separate the inputs with a space. Maybe someone who knows python better can give you a better code ^^
26th Feb 2018, 2:40 PM
Alex
Alex - avatar
0
yes. you need to input all values before the code runs here in sololearn
26th Feb 2018, 2:44 PM
Alex
Alex - avatar