-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex32.py
More file actions
27 lines (21 loc) · 682 Bytes
/
Copy pathex32.py
File metadata and controls
27 lines (21 loc) · 682 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
the_count = [1,2,3,4,5]
fruits = ['apples', 'oranges', 'pears', 'apricots']
change = [1, 'pennies', 2, 'dimes', 3, 'quarters']
#this for loop goes through a list
for number in the_count:
print(f"This is count {number}")
for fruit in fruits:
print(f"A fruit type: {fruit}")
#We can go through mixed lists too
#We use an empty {} since we do not know what's in it
for i in change:
print(f"I got {i}")
#We can also build lists; first start with an empty one
elements = []
for i in range(0, 6):
print(f"Adding {i} to the list.")
# append is a function that lists understand
elements.append(i)
# Now we can print that list:
for i in elements:
print(f"Element was: {i}.")