1. 程式人生 > >python 第三章課後習題

python 第三章課後習題

3.1
a=60
for i in range(10):
    a=a+0.5
b=a*(1+0.165)
print(b)

3.2
s=1.0
for i in range(1,366):
    if i%7 in [4,5,6,0]:
        s=s*1.01
print(s)

3.4
a=input("請輸入一個五位數:")
if (a[0]==a[4])&(a[1]==a[3]):
    print("YES")
else:
    print("NO")

3.8
from tqdm import tqdm
from time import sleep
for i in tqdm(range(1,100)):
    sleep(0.01)

3.7
while True:
    for i in ['/','-','|','\\','|']:
        print("%s\r"%i,end="")