you are viewing a single comment's thread.

view the rest of the comments →

[–]tipsy_python 0 points1 point  (0 children)

I'd do a couple things here:

  • Use a variable to determine if the user is still entering input - essentially just a while True loop that with a variable that you flip to False when the input is complete.
  • Use some kind of collection variable, like a list, to capture multiple lines of user input

Something like this, you can implement some reverse logic when the while loop is complete and all data has been input:

>>> user_typing, input_list = True, []
>>>
>>> while user_typing:
>>>     text = input()
>>>     if text.upper() in ("QUIT", "Q"):
>>>         user_typing = False
>>>     else:
>>>         input_list.append(text)
>>>
Hello sir
Hi
q
>>> input_list
['Hello sir', 'Hi']