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

Is it possible to let a user input any number of words one per line using the input function?

I was wondering is it possible to let a user enter any number of words one per line using the input function. So for example, let’s say I have the following prompt:

Enter any number of words, one per line, or a blank line to stop:

and the output is something like this:

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

hello

my

name

is

dave

What would the code for this look like?

>Solution :

simply :

while True:
    x = input()
    if x == '':
        break
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