import sys
total = 0
while True:
try:
num = float(input("Enter a number: "))
print(num, "has been added to the total")
total += num
except:
print("This is not a number. Please re-enter")
continue
while True:
again = input("Would you like to enter another number to add (Y or N)? ")
if again == "Y" or "y":
break
elif again == "N" or "n":
print("The sum of the numbers is:", total)
sys.exit()
else:
print("Invalid response. Please enter Y or N")
My issue is after I introduced the second while loop. It seems only to be processing the if again == "Y" or "y":
It will break and go back to the first loop which is what I want. However it does not process the rest of the conditions. Like if the input is "N" or anything else, it will break and ignore what I have it set to do. Your help is very appreciated.