In [ ]:
x = [1, 2, 3, 4, 5]
for item in x:
print item

In [ ]:
x = [1, 2, 3, 4, 5]
for item in x:
print x

In [ ]:
for i in range(10):
print i

In [ ]:
for i in range(10):
if i % 3 == 0:
print i

In [ ]:
for i in range(10):
print i
if i % 3 == 0:
continue

In [ ]:
for i in range(10):
if i % 3 == 0:
continue
print i

In [ ]:
for i in range(10):
if i % 3 == 0:
continue
print i

In [ ]:
for i in range(10):
if i == 4:
break
print i

In [ ]:
for x in 'hello':
print x

In [ ]:
for x in ['mango', 'pineapple', 'strawberry']:
print x

In [ ]:
for x in ['mango', 'pineapple', 'strawberry', 'kiwi']:
if len(x) > 5:
print x

In [ ]:
for x in ['mango', 'pineapple', 'strawberry', 'kiwi']:
if x in ['mango', 'strawberry']:
print "My favorite " + x

In [ ]:
# This one is tricky! Watch out for this mistake!
for x in ['mango', 'pineapple', 'strawberry', 'kiwi']:
if x == 'mango' or 'strawberry':
print "My favorite " + x

In [ ]:
# This is the correct way to write the example above.
for x in ['mango', 'pineapple', 'strawberry', 'kiwi']:
if x == 'mango' or x == 'strawberry':
print "My favorite " + x

In [ ]:
x = 'long word'
for i in range(0,len(x)/2):
print i