Python Looping Techniques
looping thru list
li = ['cube', 'sphere', 'reactangle' ]
for i, v in enumerate(li):
print i,v
print i,v
1 sphere
2 reactangle
Looping thru Dictionary
a = {'translate': '25', 'rotate': '4'}
for k, v in a.iteritems():
print k, v
translate 25
rotate 4
rotate 4
List Comprehension
squares = [x**2 for x in range(10)]
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
squares = map(lambda x: x**2, range(10))
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]