+ 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.
4 Antworten
+ 4
Python 2.#
print a
Python 3.#
print (a)
+ 4
python 2 vs python 3
sololearn uses python 3
+ 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.
+ 2
You can still see such primitive printing in Ruby, supposedly one of the descendant languages of Python