So, I wrote this simple piece of code which takes a list of lists as an argument and sums each sublist's items.
def addItems(li):
for k in li:
sum = 0
for i in k:
sum += i
print " + ".join(["%d" % (i) for i in k]) + " = %d" % (sum)
When I try to import the module in python2.7, I succeed.
However, when I try to do the same in python3.5, it brings up this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/george/Desktop/random/pyproj/myLibs/firstLib.py", line 9
print " + ".join(["%d" % (i) for i in k]) + " = %d" % (sum)
^
SyntaxError: invalid syntax