-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist_demo3.py
More file actions
28 lines (24 loc) · 770 Bytes
/
Copy pathlist_demo3.py
File metadata and controls
28 lines (24 loc) · 770 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
def loop_list():
flowers = ['calla', 'lily', 'jasmine', 'forget me not', 'sunflower', 'ivy', 'gypso']
# for f in flowers:
# print(f)
#
# for i in range(len(flowers)):
# print("{}. {}".format(i+1, flowers[i]))
for i, e in enumerate(flowers):
print("{}. {}".format(i+1, e))
def loop_list2():
countries = [
("th", "Thailand", "ไทย"),
("jp", "Japan", "ญี่ปุ่น"),
("kr", "Korea", "เกาหลีใต้")
]
# for country in countries:
# # print(country)
# print(country[2])
# iterate, traverse, loop
for i, country in enumerate(countries):
# print(country)
print("{}. {}".format(i + 1, country[2]))
# loop_list()
loop_list2()