0
How can i Storage the 4 inputs in a list?
3 Antworten
+ 6
1. You need to use range() function, instead of round() function. Don't forget to specify an argument for range() so it will loop as many times as you need.
2. Take "print(list)" out of a loop, so it will be printed only once, after loop is finished.
3. It's worth mentioning that "list" is a built-in function, to convert something into a list. It is not advisable to use it as a variable name.
+ 5
my_list=[]
for i in range(4):
my_list.append(input())
print(my_list)
+ 3
# Here's a shorter one:
my_list = [input() for i in range(4)]
print(my_list)