+ 2
Why is this code not running
spam = input("enter a integer") if spam > 5: print("rizu") if spam < 5: print("gautam")
3 Answers
+ 16
Use this GAUTAM SHARMA :
spam = int(input("enter a integer : "))
if spam > 5:
print(" rizu")
if spam < 5:
print(" gautam")
+ 3
use type conversion for input
spam = int(input("enter num"))
+ 3
GAUTAM SHARMA,
instead of using to if statement why don't you use an 'else' clause:
spam = int(input("enter an integer: "))
if spam > 5:
print("rizu")
else:
print("gautam")
This solution will also include the situation when spam = 5.