You are probably using Python 2.x. Remove the parentheses. print
is a statement in Python 2.x, not a function. With parentheses, Python 2.x will think you are printing a tuple.
paranoid_android = "Marvin"
letters = list(paranoid_android)
for char in letters:
print('\t', char)
for char in letters:
print '\t', char
Output:
('\t', 'M')
('\t', 'a')
('\t', 'r')
('\t', 'v')
('\t', 'i')
('\t', 'n')
M
a
r
v
i
n
You can also add the following to the top of a Python 2.x script to Python 2.x work like Python 3.x, where print
is a function:
from __future__ import print_function