Sum() funcion


#1

print (sum( [123, 123, 12, 12] ) )
Why does it need soo many bracets?
why does = print sum( [123, 123, 12, 12] ) dosent work, or
print sum(123, 123, 12, 12)


#2

It depends on the version of Python you are using, in 2.7.* you can use print like

print 'Hello'

In 3.* it changed to a built-in function so you call it using

print('Hello')

It is version specific but in python 2.7.* you can use the 3.* method of printing but not the 2.7.* in the later version.