Commit d951efba by BellCodeEditor

save project

parent 0927f964
Showing with 37 additions and 0 deletions
# 期末考试结束了,悟空在教务系统查到了自己的几门必修课分数,他想通过python计算自己的平均分。
# 于是写了下面的代码,可是总是得不到结果,请帮纠正bug并跑通程序。
scores = {'语文':89, '数学':95, '英语':80}
def get_average(scores):
sum_score = 0
for subject, score in scores.items():
sum_score=sum_score+score
print('现在的总分是%d'%sum_score)
ave_score =sum_score/len(scores)
print('平均分是%d'%ave_score)
get_average(scores)
name1 = input('输入人名1:')
name2 = input('输入人名2:')
s = '我的同学是'+name1+'和'+name2
print(s)
s = '%d/%d的结果是%f '%(35, 3, 35/3)
print(s)
s = '大家好,我叫{a},今年{b}岁'.format(a=name1,b=20)
print(s)
b="大家好,今天是星期%d,温度为%f,天气%s"%(3,35.5,"晴")
print(b)
b="大家好,今天是星期{a},温度为{b},天气{c}".format(a=3,b=35.5,c="晴")
print(b)
import turtle
pen=turtle.Pen()
def sjx(a):
for i in range(3):
pen.forward(a)
pen.left(120)
sjx(50)
turtle.done()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment