python3 下載 以及 練習1
下載python:
https://www.python.org/downloads/release/python-365/
下載python 社區版(Community
https://www.jetbrains.com/pycharm/download/download-thanks.html?platform=windows&code=PCC
https://blog.csdn.net/chenggong2dm/article/details/9365437
1.編程實現9*9 的乘法口訣
# 長方形的99乘法
for i in range(1,10):
for j in range(1,10):
print("%d*%d=%2d" % (i, j, i*j),end=" ")
print("")
2.我國有13億人口。年增長率位0.8%, 多少年超過40億
i=1
a=13
while a<40:
a=a*(1.008)
i=i+1
if a >=40:
break
print (i)
3.編程計算一個班100名學生的平均成績,然後統計高於平均分的人數
count = 5
s = []
for i in range(count):
print(i+1)
name = input(‘name:‘)
score = input(‘score:‘)
t = {}
t[‘name‘] = name
t[‘score‘] = int(score)
s += [t]
#max = 0
#min = 0
all=0
sum = 0
for i in range(count):
sum += s[i][‘score‘]
a = int(sum/count)
print(a)
for i in range(count):
if a < s[i][‘score‘]:
all = all + 1
# if min > s[i][‘score‘]:
# min = i
# sum +=s[i][‘score‘]
#print(‘max:‘ + s[max][‘name‘] + ‘ ‘ + str(s[max][‘score‘]))
#print(‘min:‘ + s[min][‘name‘] + ‘ ‘ + str(s[min][‘score‘]))
print(‘total:‘ + str(all))
python3 下載 以及 練習1