Example take multiple inputs in Python using while loop
Simple example codes Multiple Inputs with Python using While Loop. Exit the loop if the user enters “stop”.
while True: reply = input("Enter Text: ") if reply == 'stop': break print(reply)
Take multiple inputs and append them to the list. If you use an infinite loop then break it if the input is 0.
values =  while True: val = int(input("Enter an integer, 0 for Exit: ")) if val == 0: break values.append(val) print(values)
Enter an integer, 0 for Exit: 1
Enter an integer, 0 for Exit: 2
Enter an integer, 0 for Exit: 0
Do comment if you have any doubts or suggestions on this Python multiple input code.
Note: IDE: PyCharm 2021.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.