How can I make sure the user input only 'y' or 'n' in and make the program only accept 'y' or'n' as an answer?
while True:
try:
cont = input("Do you want to continue? If so enter 'y'.")
if cont != "n" or cont !="y":
print("Please enter 'y' or 'n'")
else:
break
except ValueError:
print("Please enter 'y' or 'n'")
else:
break