Hi guys, I've been practicing lists in python recently and I've been having issues trying to print a list in python. I want to print out all the items in a list with the code below, especially the last two lines
def primefind(n):
mylist = []
x = 3
while (x < n/2):
if ((n % x) == 0):
mylist.append(x)
x = x + 2
for item in mylist:
print item
I am getting a syntax error when I run this. It highlights "item" in the last line. As far as I can tell it's syntactically correct so I am confused! Even this site shows the same syntax as I've used http://effbot.org/zone/python-list.htm#looping
Any ideas where I've gone wrong?