+ 1

I am trying to run the code below in Ubuntu but I am getting it wrong.

if 10 > 5: print("10 greater than 5") print("Program ended")

29th Jun 2017, 7:28 PM
Sidibe Mohamed
9 odpowiedzi
0
but Python 2 supports both with parentheses and with out parentheses.
30th Jun 2017, 3:44 AM
Rohan Vijayvergiya
Rohan Vijayvergiya - avatar
+ 4
Hmm... working fine even in Sololearn. Maybe you are using Python 2.7 on your Ubuntu installation?
29th Jun 2017, 7:41 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 3
In Python 2.7 print is a statement, not a method. Its syntax is indeed with no parentheses, like @shaldem suggested.
29th Jun 2017, 8:12 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 3
if 10 > 5: print "10 greater than 5" print "Program ended" # so to say it simply - write the same without the brackets
29th Jun 2017, 8:38 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
0
Yes please I am using python 2.7. but what can I do to make it work please?
29th Jun 2017, 7:46 PM
Sidibe Mohamed
0
Hmm, I think you need to right print in anather wey, like this: print "Program ended"
29th Jun 2017, 7:55 PM
shaldem
shaldem - avatar
0
please what can I do to solve this Kuba?
29th Jun 2017, 8:18 PM
Sidibe Mohamed
0
please what can I do to solve this Kuba?
29th Jun 2017, 8:18 PM
Sidibe Mohamed
0
thank you all, it works now.
30th Jun 2017, 5:27 AM
Sidibe Mohamed