0

i literally do not understand how to ignore string input

userInputf = input() userInput = input() if userInput or userInputf != int print("error") if userInput > : print("Larger than " + userInputf) else: print("Smaller than " + userInputF) if userInput < 50: print(userInput)

24th May 2021, 1:49 AM
DIO
DIO - avatar
2 odpowiedzi
+ 8
#You can use isdigit() to check whether the input consists of digits only userInputf = input() userInput = input() #if userInput or userInputf != int #print("error") if userInput.isdigit() and userInputf.isdigit(): if userInput > userInputf : print("Larger than " , userInputf) else: print("Smaller than ", userInputf) else: print("Error")
24th May 2021, 2:21 AM
Simba
Simba - avatar
+ 3
Simba I am afraid that there is a simpler solution than isdigit() method. Care to try again?
24th May 2021, 7:24 AM
Gordon
Gordon - avatar