Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to set up user input asking for a list one at a time?

enter image description here

I am trying to replicate this python code but I am unsure how to go about asking for a user inputted list one at a time and then how to present the list in order and then randomly. If anyone could point me in the right direction I would appreciate it

total = 0
while True:
    List = input('Enter an item or "done" to stop entering items: ')
    if List == 'done':
        break
print(List)

This was my original idea but I don’t think it makes any sense

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Append the input on an array:

all_values = []
while True:
    value = input('Enter an item or "done" to stop entering items: ')
    if value == 'done':
        break
    all_values.append(value)
print(all_values)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading