课后练习:
2、奇数
for循环
for x in range(1,22,2):
print(x)
while循环
i=1
while i<=21:
print(i)
i+=2
1
3
5
7
9
11
13
15
17
19
21
3、我最喜爱的五种食材
ingredients = ['snails','leeches','gorilla belly-button lint','caterpillar eyebrows','centipede toes']
i = 1
for x in ingredients:
print(i,x)
i+=1
1 snails
2 leeches
3 gorilla belly-button lint
4 caterpillar eyebrows
5 centipede toes
若要输出“A B”,则print(A,B),不能用print(A B)
4、你在月球上的体重
tz = 75
for x in range(0,15):
yqtz = (tz + x) * 0.165
print(yqtz)
12.375
12.540000000000001
12.705
12.870000000000001
13.035
13.200000000000001
13.365
13.530000000000001
13.695
13.860000000000001
14.025
14.190000000000001
14.355
14.520000000000001
14.685