User input | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

User input

How to make the user enter more than 1 value(eg make them enter a list of numbers )

12th Nov 2018, 2:23 PM
Leboman HKD Galis
Leboman HKD Galis - avatar
3 Answers
+ 7
If you want to take a list as input, look at this code. Just escape the part after line 13. https://code.sololearn.com/cs5obxeuKgf5/?ref=app
12th Nov 2018, 2:29 PM
Arushi Singhania
Arushi Singhania - avatar
+ 4
numbers = list(map(int, input().split()))
12th Nov 2018, 6:44 PM
Flandre Scarlet
Flandre Scarlet - avatar
0
lst =[int(x) for x in input().split(',')] here lst is simply the name given to the list and instead of split(',') u can use split() for numbers to be entered separated by spaces.
13th Nov 2018, 8:55 AM
Suzan
Suzan - avatar