-
Notifications
You must be signed in to change notification settings - Fork 0
/
judge_and_loop.py
65 lines (52 loc) · 1.13 KB
/
judge_and_loop.py
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
'''
expre = True
if expre:
print(1)
else:
print(2)
if not expre:
print(1)
elif False:
print(2)
elif False:
print(3)
else:
print(4)
a = 3
b = 2 if a != 3 else 3
print(b)
a = -10
b = -a if a < 0 else a
print(b)
'''
# for item in iterator:
# ...
ss = ""
for s in ['mon', 'tue','wed']:
ss += s # equi to ss = ss + s
ss += "0"
ss = ss.strip("0")
# print(ss, s, sep='\n')
# for item in ['mon', 1, ['tues', 2, ['wed', 3]]]:
# print(item, end=' ')
# print()
# for i in range(10): # equi to range(0, 10)
# print(i, end=" ")
# # print(i, end=" ", file=open("output.txt", 'a+'))
# print()
# for i in range(10, 20): # (begin, end) , equi [begin, begin+1, ..., end-1], not include end
# print(i, end=" ")
# print()
# for i in range(10, 20, 3): # (begin, end, step) , equi [begin, begin+step, ...], not include end
# print(i, end=" ")
# print()
# for i in range(10, 20): # print the number in [10, 20) that is divided by 5
# if i % 5==0:
# print(i, end=' ')
# print()
i = 0
s = 0
while i<=10:
i += 1
s += i
print(s)