I have a school exercise where I have to write a program that outputs ‘Odd number’ or ‘Even number’ when a user inputs an integer. Keep looping until user presses Q to stop the program. So far I have this;
while(True):
num= int(input("Enter a number"))
mod= num % 2
if (mod > 0):
print("This is an odd number")
elif (mod == 0):
print("This is an even number")
else:
print("Bye")
exit()
However, since Q is not an integer, it gives me a ValueError. How should I do this exercise? Thanks