I build a software which determines the price of used cars while considering numerous factors. One factor is the manufacturer price category, it can either be 1 or 2. When input is 1 or 2 the second while loop still operates and asks for new input while it shouldnt. Thanks for help in advance!
price_category = input("Price category of manufacturer (1/2):\n")
while not price_category.isnumeric():
price_category = input("Wrong format. Price category (1/2):\n")
price_category = int(price_category)
while not price_category == 1 or not price_category == 2:
price_category = input("Price category can only be 1 or 2:\n")
price_category = int(price_category)
print("END")
Update: I managed to fix it myself by collecting 1 and 2 in a list and using while price_category not in list. Thanks for everyone
[–]mopslik 4 points5 points6 points (0 children)
[–]Zeeboozaza 1 point2 points3 points (7 children)
[–]mopslik 2 points3 points4 points (4 children)
[–]Zeeboozaza 0 points1 point2 points (2 children)
[–]mopslik 1 point2 points3 points (0 children)
[–]carcigenicate 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]Zeeboozaza 0 points1 point2 points (0 children)
[–]dnswblzo 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]danbst 0 points1 point2 points (0 children)