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)
2 Respostas
+ 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")
+ 3
Simba I am afraid that there is a simpler solution than isdigit() method.
Care to try again?