+ 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
4 Réponses
+ 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_)
#...
+ 1
Jay Matthews
By . You ment just repeat that or its a short cut
0
Thanks!
0
for x in range(99999):
try: print(input())
except: pass