I am writing a program in python where you have to guess the number chosen by the computer. The number will be chosen between 0 and 10(inclusive of both the number). If the number guessed by the user is correct or wrong, a message will be shown based on the validity of the input (the number guessed by the user), followed by the number chosen by the computer as the outputs. The output should be something like this.
ENTER: 4 Wrong Computer: 10
ENTER: 10 RIGHT! Computer: 10
The Problem is that the computer's choice(Computer:10) is not appearing on the console window. The IDE on which I am making this program is telling me that "CODE IS UNREACHABLE".
My code: IDE = Pycharm
from random import randint def guessing_game(x): guess = randint(0,10) if x.isdigit(): if x==guess: return "RIGHT!" print(" COMPUTER =" guess) else: return "Wrong" print("COMPUTER="guess) elif x.isdigit() == False: return " Enter a Number" print(guessing_game(input("ENTER:")))
Therefore, please help me to solve this issue.All suggestions will be appreciated.