#运行超市抹零结账行为
money_all = 56.75 + 72.91 + 88.50 + 26.37 + 68.51
print("商品总金额为:%.2f"%money_all )
print("实收金额:%d"%(int(money_all)))
print("学号:2022310143125")
#计算学生成绩的分差和平均分
python,english,c = 95,92,89
avg = (python + english + c) / 3
print("Python课程和C语言课程的分数之差:%d分"%(python - c))
print("三门课程的平均分:%d分"%avg)
print("学号:2022310143125")
#比较运算符比较大小关系
python,english,c = 95,92,89
print("python ={0} english ={1} c={2}".format(python,english,c))
print("python < english的结果: " , python < english)
print("python > english的结果: ",python > english)
print("python == english的结果: ",python == english)
print("python != english的结果: ", python != english)
print("python <= english的结果: ",python <= english)
print("english >= c的结果: ",english >= c)
print("学号:2022310143125")
#手机店打折活动
print("手机店正在打折,活动进行中……")
strweek = input("请输入中文星期(如星期一) : ")
intTime = int(input("请输入时间中的小时(范围:0~23) : "))
if (strweek == "星期二" and 10<=intTime<=11) or (strweek == "星期五" and 14<=intTime<=15):
print("恭喜您,获得了折扣活动参与资格,快来领取吧!")
else:
print("对不起,您来晚一步,期待下次活动……")
print("学号:2022310143225")
#新建一个文件,并保存一段话。
file = open('test.txt', 'w')
file.write('2.6.2')
file.close()
标签:读书笔记,python,money,2022310143125,file,english,print,第二章 From: https://www.cnblogs.com/slowdowna002/p/17801070.html