0

How can i Storage the 4 inputs in a list?

https://code.sololearn.com/c910SUfSb46M/?ref=app

10th Mar 2023, 5:33 PM
Ammar Alshawafi
Ammar Alshawafi - avatar
3 Answers
+ 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.
10th Mar 2023, 5:39 PM
Lamron
Lamron - avatar
+ 5
my_list=[] for i in range(4): my_list.append(input()) print(my_list)
10th Mar 2023, 5:38 PM
Per Bratthammar
Per Bratthammar - avatar
+ 3
# Here's a shorter one: my_list = [input() for i in range(4)] print(my_list)
10th Mar 2023, 5:51 PM
Per Bratthammar
Per Bratthammar - avatar