0

Several entries in the same variable

Hello guys, a question. Is it possible to store several entries made by the user in a list of the same variable and then print them on the screen in order of entry? I'm learning to work in python, so I would appreciate your help with an explanation in that language

2nd Dec 2023, 3:01 AM
EMAKILLER
EMAKILLER - avatar
4 Réponses
+ 7
Yes! However, all input needs to be entered in the pop up window when you execute the program. Multi input entered on one line, seperated by spaces: https://code.sololearn.com/cvTdHZl4gpl1/?ref=app Multi line input (nested lists): https://code.sololearn.com/ckn3jO4yuPJq/?ref=app Similar discussion: https://www.sololearn.com/Discuss/3254453/?ref=app
2nd Dec 2023, 3:32 AM
Keith
Keith - avatar
+ 5
Yes, try splitting the input.
2nd Dec 2023, 3:12 AM
Slick
Slick - avatar
+ 3
You can review this code and observe the action. Please read the code comments first, you need to provide the inputs before the code runs. https://sololearn.com/compiler-playground/cfT6UG8vUTTJ/?ref=app
2nd Dec 2023, 4:41 AM
Wong Hei Ming
Wong Hei Ming - avatar
+ 2
You can push items into a list and recall them one at a time easily. list = [] for i in range(5): list.append(input()) for item in list: print(item) Simply alter the number in range() to reflect how many inputs you want to take. Note the code above won't work in the sololearn codespace they way its intended but will work in other Python IDEs. You can download one for free for desktop, android or ios easily to practice. To use the above on sololearn, enter the number of inputs in range() on separate lines in the input prompt.
2nd Dec 2023, 8:17 AM
StuartH
StuartH - avatar