第二回作业

# 03 模拟超市结账行为
money_all = 56.75 + 72.91 + 88.50 + 26.37 + 68.51
money_all_str = str(money_all)
print("商品总金额为:"+money_all_str)
money_real = int(money_all)
money_real_str = str(money_real)
print("实收金额为:"+money_real_str)
print("3139")

 

# 04 计算学生成绩的分差及平均分
python = 95
english = 92
c = 89
sub = python - c
avg = (python + english + c) / 3
print("Pyhon课程和C语言课程的分数之差:"+ str(sub) + "分\n")
print("3门课的平均分: "+str(avg)+"分")
print("3139")

# 05 使用比较运算符比较大小关系
python = 95
english = 92
c = 89
print("python = "+ str(python) + "english = " +str(english) + "c = "+str(c)+"\n")
print("python < english的结果:"+ str(python<english))
print("python > english的结果:"+ str(python>english))
print("python == english的结果:"+ str(python==english))
print("python != english的结果:"+ str(python!=english))
print("python <= english的结果:"+ str(python<=english))
print("python >= english的结果:"+ str(python>=english))
print("3139")

 

posted @ 2021-09-13 21:52  doublemiracle  阅读(11)  评论(0编辑  收藏  举报