-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay5.py
More file actions
39 lines (29 loc) · 641 Bytes
/
Day5.py
File metadata and controls
39 lines (29 loc) · 641 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
37
38
39
# for loop
fruits = ["apple", "banana", "cherry"]
for item in fruits:
print(item)
for x in "le quoc tuan":
print(x)
# break statement.
for x in fruits:
print(x)
if x == "banana":
print("Dung lai o day thoi")
break
# for with range.
for i in range(10):
print(i)
# for with range from start to end ( not include end)
for i1 in range(3, 6):
print(i1)
# for with range and step
for i2 in range(3, 5, 2):
print(i2)
# Nested loops.
adj = ["red", "big", "tasty"]
fruits = ["apple", "banana", "cherry"]
for x in adj:
for y in fruits:
print(x, y)
for x in range("a","z"):
print(x)