Why does the isdigit check not work properly /u/Sanduhstorm Python Education

import random is_running = True num = random.randint(0, 100) isnum = True while is_running: guess = input("Guess the number from 0 to 100 ") while guess.isdigit == False: print("Please enter a valid number") guess = input("Guess the number from 0 to 100") guess = int(guess) if guess > num: print("Lower!") elif guess < num: print("Higher!") else: print(f"{guess} is correct!") break input("Press any key to exit")import random is_running = True num = random.randint(0, 100) isnum = True while is_running: guess = input("Guess the number from 0 to 100 ") while guess.isdigit == False: print("Please enter a valid number") guess = input("Guess the number from 0 to 100") guess = int(guess) if guess > num: print("Lower!") elif guess < num: print("Higher!") else: print(f"{guess} is correct!") break input("Press any key to exit") 

submitted by /u/Sanduhstorm
[link] [comments]

​r/learnpython import random is_running = True num = random.randint(0, 100) isnum = True while is_running: guess = input(“Guess the number from 0 to 100 “) while guess.isdigit == False: print(“Please enter a valid number”) guess = input(“Guess the number from 0 to 100”) guess = int(guess) if guess > num: print(“Lower!”) elif guess < num: print(“Higher!”) else: print(f”{guess} is correct!”) break input(“Press any key to exit”)import random is_running = True num = random.randint(0, 100) isnum = True while is_running: guess = input(“Guess the number from 0 to 100 “) while guess.isdigit == False: print(“Please enter a valid number”) guess = input(“Guess the number from 0 to 100”) guess = int(guess) if guess > num: print(“Lower!”) elif guess < num: print(“Higher!”) else: print(f”{guess} is correct!”) break input(“Press any key to exit”) submitted by /u/Sanduhstorm [link] [comments] 

import random is_running = True num = random.randint(0, 100) isnum = True while is_running: guess = input("Guess the number from 0 to 100 ") while guess.isdigit == False: print("Please enter a valid number") guess = input("Guess the number from 0 to 100") guess = int(guess) if guess > num: print("Lower!") elif guess < num: print("Higher!") else: print(f"{guess} is correct!") break input("Press any key to exit")import random is_running = True num = random.randint(0, 100) isnum = True while is_running: guess = input("Guess the number from 0 to 100 ") while guess.isdigit == False: print("Please enter a valid number") guess = input("Guess the number from 0 to 100") guess = int(guess) if guess > num: print("Lower!") elif guess < num: print("Higher!") else: print(f"{guess} is correct!") break input("Press any key to exit") 

submitted by /u/Sanduhstorm
[link] [comments] 

Leave a Reply

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