Python Multiple Inputs | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Python Multiple Inputs

Hi, im very new to coding, hence why I picked to learn python. Anyways im wondering how I can collect multiple (specifically 4) different labeled inputs. For example I need a different number input connected to A B C and D so that I can put them into an equation separately. As I said im very new so any help is needed. Thanks

4th Apr 2022, 10:25 PM
Austen Covell
4 Answers
+ 2
Austen Covell , when we need several input values, we should use a list to store them. it should be possible to input a various number of values. to stop input, we can use just the enter key. res = [] while inp := input(): # the loop run as long as there is an input given, but stops when input is empty res.append(inp) print(res) # to use the input, we can work with index like: print(res[len(res) -1]) # or we can iterate through this list of inputs like: for inp_ in res: print(inp_) #...
9th Apr 2022, 6:50 PM
Lothar
Lothar - avatar
+ 1
Jay Matthews By . You ment just repeat that or its a short cut
5th Apr 2022, 6:20 PM
Lz1234
0
Thanks!
5th Apr 2022, 2:29 AM
Austen Covell
0
for x in range(99999): try: print(input()) except: pass
5th Apr 2022, 4:55 AM
Fꫀⲅძ᥆͟ᥙ᥉᯽
Fꫀⲅძ᥆͟ᥙ᥉᯽ - avatar