-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathex32.py
More file actions
38 lines (24 loc) · 735 Bytes
/
ex32.py
File metadata and controls
38 lines (24 loc) · 735 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# lists and for loops
hairs = ['brown', 'blonde', 'red', 'black']
eyes = ['black', 'brown', 'green', 'blue']
theCount = [1, 2, 3, 4, 5]
fruits = ['apples', 'oranges', 'pears', 'apricots']
change = [1, 'pennies', 2, 'dimes', 3, 'quarters']
for number in theCount:
print("This is the count %d" % number)
for fruit in fruits:
print("A fruit of type %s " % fruit)
for i in change:
print("I got %r" % i)
# we can also build lists
elements = []
for i in range(0, 6):
print("Adding %d to the list" % i)
elements.append(i)
# now we print
for i in elements:
print("Element was: %d" % i)
for eye in eyes:
print("I love %s eyes." % eye)
for hair in hairs:
print("I love girls with %s hairs!" % hair)