Basically, I want to create a loop that will continue getting string inputs from users until the user types only a "#" on a line.
I am coming from C++ so I am a bit lost in this Python project I have in mind.
Basically, I want to create a loop that will continue getting string inputs from users until the user types only a "#" on a line.
I am coming from C++ so I am a bit lost in this Python project I have in mind.
try this:
last_input = ''
while (last_input != '#'):
last_input = input()
You'll probably want to do something else with the data, but this will keep asking until the user provides just #
And if you want to save all the inputs:
last_input = ''
all_input = [] # list to catch user input
while (last_input != '#'):
last_input = input()
all_input.append(last_input)