Python Programming - Console Input/Output - Discussion

Discussion Forum : Console Input/Output - General Questions (Q.No. 33)
33.
How can you read multiple lines of text from the console until a specific keyword is entered?
read_lines_until_keyword("exit")
while True: line = input(); if line == "exit": break; print(line)
lines = input("Enter text (type 'exit' to stop): ")
read_text_with_keyword("exit")
Answer: Option
Explanation:
To read multiple lines of text until a specific keyword 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.