I just started learning Python with Pythonista and the book 'Head First Python'
There is an exercise which I do not understand. I create a list variable: eg
movies = [ 'and', 'bin', 'can','den']
and then the code snippet:
for each_item in movies: print(each_item)
and
bin
can
den
Which as expected prints each string on a new line. When I put this code into this function:
def print_list(My_list):
for an_item in My_list:
if isinstance(My_list,list):
print_list(an_item)
else:
print(an_item)
print_list(movies)
the list entries print out each character of each string on a new line. What is going on here?
a
n
d
b
i
n
.
.
.