+ 3
Input in Loop (Python)
Hey can anyone Tell me How i can ask for various Input in a Loop?? I thought it should work like this: for i in range(5): input = input() print(input) But this doesnt work apparently:/ Thanks in advance✌🏼
6 Réponses
+ 6
1. It is not recommended to use functions (e.g. input) as variable names as it can mess up with your code.
2. All inputs must be entered before the code is executed (that's the way it is with non web languages on SoloLearn). Try entering this as input (in separate lines).
hello
darkness
my
old
friend
+ 5
You can take multiple inputs using this statement :
x,y,z=[int(x) for x in input("Enter values").split()]
This is use to take all the inputs in one line
+ 4
The code will run as far, as the user types the input. So if the user doesnt anything, your code will stuck at the same point. I underdtand what you mean, but i dont really know, sorry..
However, on sololearn its only possible to take at least 1 input, because here, the person can either see the input field, or the Console.. So it dont makes really much sense😉
I Hope that i could help you😊💛
+ 3
Agree with above. input is a variable storing a function. By overriding with your own definition, you are essentially getting rid of all the coding that went behind making the input function.
I think that is what is wrong with your code.
+ 1
thanks everyone. by now i lesrned that this problem only occurs on sololearn.
and of course i would name it differently in a real code. sorry for the confusion✌🏼✌🏼
- 1
For I in range(1,6):
Print(append. Input[i])