+ 1

What is wrong with this code?

a = input ("insert number: ") if (a) > 5: print("(a) greater than 5")

7th May 2017, 1:38 PM
Vasu Gandhi
Vasu Gandhi - avatar
6 Answers
+ 11
a = input("insert number: ") a = int(a) if a > 5: print("{0} greater than 5".format(a))
7th May 2017, 1:46 PM
Complex
Complex - avatar
+ 7
Can you tell me what error it says or what should be the correct output?
7th May 2017, 1:44 PM
Complex
Complex - avatar
+ 5
@Vasu Gandhi We're happy to help buddy =D
7th May 2017, 2:10 PM
Complex
Complex - avatar
+ 2
if I input 25, I want output to be "25 is greater than 5"
7th May 2017, 1:45 PM
Vasu Gandhi
Vasu Gandhi - avatar
+ 1
thanks for your help complex and steini!
7th May 2017, 1:51 PM
Vasu Gandhi
Vasu Gandhi - avatar
+ 1
see by default any input is a string that's why add int before your input command like this: >>> a=int(input("ENTER")) >>> if a>5: print("END") And adding the brackets around the a makes no sense but since it is not affecting the program in any way I guess it doesn't matter
15th May 2017, 2:08 PM
Piali Chatterjee
Piali Chatterjee - avatar