+ 1
How to get multiple inputs from users?
Idk how to get like 10 numbers from users in input at once and not use 10 different characters .help me with that plz
6 ответов
+ 6
tara , you can use several approaches for this:
(1) if the "numbers" you are talking about are all just 1-digit numbers, the input can be like:
153280
you can turn this in a list and do the conversion to int in a comprehension (use list(...) to split input to individual digits)
(2) if the "numbers" you want to get have more than 1 digit, you can input them like:
1 14 0 8 -4 24
you can turn this input also in a list and do the conversion in a comprehension (use split('')). If you like you can also use an other separator to input your numbers.
+ 4
You can use loops for that.
+ 3
I couldn't understand from what u said 10 different characters.
If you want to take 10 inputs in python, you have to either make 10 input statements or make a loop that iterates 10 times.
And in the loop append the user input after taking input.
Hope it helps...
+ 2
You can just use for loop
Inputs = [ ]
for i in range(10):
inputs.append(input())
Hope It Helps You 😊
+ 1
Thank you all so much ❤