print without ()

Andrej Viktorovich viktorovichandrej at gmail.com
Thu Sep 7 02:14:31 EDT 2017


Hello,

Sometimes I find code with strange print function usage. String is passed without brackets.

#!/usr/bin/python
list = ['physics', 'chemistry', 1997, 2000];
print "Value available at index 2 : "
print list[2]
list[2] = 2001;
print "New value available at index 2 : "
print list[2]

If I use command print "aaa" in console I get error. So, why this is allowed in sample?

Sample from:
https://www.tutorialspoint.com/python/python_lists.htm




More information about the Python-list mailing list