You never change uinput
in your loop, so once your program enters the loop, it never leaves (well, until Python runs out of memory).
The simplest way is to restructure your loop so the input
call is insidie it. A separate if
statement is used to test the input and break out of the loop.
account_number = []
while True:
uinput = input('Type some Bank account numbers. Type "quit" to stop: ')
if uinput == "quit":
break
account_number.append(int(uinput))
account_number = frozenset(account_number)
print(account_number)
You can also use two input()
statements as shown by Jhanzaib. This strategy (which I learned to call a "priming read" when learning Pascal back in high school) works fine, but the difficulty is that you will need to change the prompt in two places if you ever need to change it. Of course, you can use a variable to hold the prompt (or better yet, put it into a function where you pass in the prompt). Or you can exploit the fact that you have two input()
s to offer different prompts ("enter the first account number", "enter the next account number").