What's wrong with this code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's wrong with this code?

num1 = input("Tell me a number: ") num2 = input("Tell me another number: ") if num1>num2: print "%d is greater than %d!" % num1,num2 elif num2>num1: print "%d is greater than %d!" % num2,num1

9th Jul 2017, 3:06 PM
Captain George
Captain George - avatar
2 Answers
+ 6
Looks like old Python (2.x) syntax? print() requires parentheses in version 3.x % syntax works but there's also: print( "{} is greater than {}".format(num1, num2) )
9th Jul 2017, 3:15 PM
Kirk Schafer
Kirk Schafer - avatar
+ 1
Thanks a lot!
9th Jul 2017, 4:58 PM
Captain George
Captain George - avatar