+ 2

Why is this code not running

spam = input("enter a integer") if spam > 5: print("rizu") if spam < 5: print("gautam")

7th Jun 2018, 4:30 PM
GAUTAM SHARMA
GAUTAM SHARMA - avatar
3 Respostas
+ 16
Use this GAUTAM SHARMA : spam = int(input("enter a integer : ")) if spam > 5: print(" rizu") if spam < 5: print(" gautam")
7th Jun 2018, 4:36 PM
***
+ 3
use type conversion for input spam = int(input("enter num"))
7th Jun 2018, 4:35 PM
‎ ‏‏‎Anonymous Guy
+ 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.
7th Jun 2018, 5:08 PM
Ulisses Cruz
Ulisses Cruz - avatar