Relative Content

Tag Archive for pythonpython-3.xlistwhile-loopmu

While loop only runs the elif statement once and doesn’t flow back through the rest of the loop

I am trying to write a program that appends each line of user input to a list. Once the user enters ”, the loop should break. When their is more than 1 line of input the code executes the way it is intended.
However, there is an elif statement for when a users first input is ”, that asks the user to enter something besides ”.
Upon testing this part out, the program returns ‘Enter a list’ line you can see below, but then it ignores the rest of the program. If you enter ” again, the program exits and outputs [] when it should be going through the loop until there is a user input that is not ”