why is my code for 21 game not working (the main problem is in try and except statement according to me) /u/Own-Recipe5931 Python Education

import random startup = random.randint(1,3) print("My number is ", startup) check = startup + 3 nexnum = int(input("Enter your number n- ")) def check_round(): while nexnum > check: print("Your number is too highn Please try again") nexnum = int(input("-")) while nexnum or startup >= 21: try: nexnum = int (nexnum) check_round() except: print("Please enter a whole number") nexnum = int(input("-")) continue func1 = nexnum + 3 func2 = nexnum - 1 startup = random.randint(func2, func1) nexnum = int(input("Enter your next numbern-")) continue 

submitted by /u/Own-Recipe5931
[link] [comments]

​r/learnpython import random startup = random.randint(1,3) print(“My number is “, startup) check = startup + 3 nexnum = int(input(“Enter your number n- “)) def check_round(): while nexnum > check: print(“Your number is too highn Please try again”) nexnum = int(input(“-“)) while nexnum or startup >= 21: try: nexnum = int (nexnum) check_round() except: print(“Please enter a whole number”) nexnum = int(input(“-“)) continue func1 = nexnum + 3 func2 = nexnum – 1 startup = random.randint(func2, func1) nexnum = int(input(“Enter your next numbern-“)) continue submitted by /u/Own-Recipe5931 [link] [comments] 

import random startup = random.randint(1,3) print("My number is ", startup) check = startup + 3 nexnum = int(input("Enter your number n- ")) def check_round(): while nexnum > check: print("Your number is too highn Please try again") nexnum = int(input("-")) while nexnum or startup >= 21: try: nexnum = int (nexnum) check_round() except: print("Please enter a whole number") nexnum = int(input("-")) continue func1 = nexnum + 3 func2 = nexnum - 1 startup = random.randint(func2, func1) nexnum = int(input("Enter your next numbern-")) continue 

submitted by /u/Own-Recipe5931
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *