Jun-29-2021, 03:57 PM
there is no error raised on this line
reply = str(input("Do you want another drink Y/N "))
, so except
block is never executed and it jumps to else
block. And input()
returns str
so there is no need to explicitly convert it with str(input("Do you want another drink Y/N "))
def ask(): while True: reply = input("Do you want another drink Y/N ") if reply.lower() in ("y", "n"): print('you have correctly entered y or n') break else: print("you have incorrectly entered - pick Y/N") ask()
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs