+ 2

Print without brackets(solved)

a="hello world" print a #Instead of print(a) I've seen something like this in several tutorials and I don't understand why this works for some people. Did it work in an older version? Maybe some distribution? Why it won't work for me? I don't want to use it because it makes no sense, but I'm curious about it. Thank you all for your quick answer.

28th Sep 2017, 7:57 PM
Qwerty
4 Réponses
+ 4
Python 2.# print a Python 3.# print (a)
28th Sep 2017, 10:46 PM
▲TopGun ▲
▲TopGun ▲ - avatar
+ 4
python 2 vs python 3 sololearn uses python 3
28th Sep 2017, 9:46 PM
LordHill
LordHill - avatar
+ 4
print as a statement is one of Guido's 'Python Regrets' and was fixed to be a function in 3.x. One gotcha: tuples are surrounded by (). Make sure you know the context of the code you're reading.
28th Sep 2017, 10:36 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
You can still see such primitive printing in Ruby, supposedly one of the descendant languages of Python
28th Sep 2017, 11:29 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar