Python Programming - Console Input/Output - Discussion

Discussion Forum : Console Input/Output - General Questions (Q.No. 35)
35.
How can you read a list of strings from the console until an empty line is entered?
read_strings_until_empty()
while True: line = input(); if not line: break; strings.append(line)
input_lines = input("Enter lines (empty line to stop): ")
read_lines_until_empty("exit")
Answer: Option
Explanation:
To read a list of strings until an empty line is entered, use a while loop with a conditional break.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.