-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist_demo4.py
More file actions
41 lines (37 loc) · 1.06 KB
/
list_demo4.py
File metadata and controls
41 lines (37 loc) · 1.06 KB
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
37
38
39
40
41
def demo():
flowers = ['calla', 'lily', 'jasmine', 'forget me not', 'sunflower', 'ivy', 'gypso']
# is_exist = "daisy" in flowers
# is_exist = "Lily" in flowers
# print(is_exist)
# print(flowers.index("lily"))
# print(flowers.index("daisy"))
flowers[2] = "Jasmine"
print(flowers)
for i in range(len(flowers)):
flowers[i] = flowers[i].capitalize()
print(flowers)
flowers.clear()
print(flowers)
def demo_append():
countries = [
("th", "Thailand", "ไทย"),
("jp", "Japan", "ญี่ปุ่น"),
("kr", "Korea", "เกาหลีใต้")
]
print(countries)
fr = ("fr", "France", "ฝรั่งเศส")
countries.append(fr)
print(countries)
us = ("us", "USA", "อเมริกา")
countries.insert(2, us)
print(countries)
countries.append(("sg", "Singapore", "สิงคโปร์"))
print(countries)
# demo()
# demo_append()
alphabet = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
print(alphabet)
a = [0] * 10
print(a)
b = [1, 3] * 5
print(b)