第11题

时间:2021-09-16
本文章向大家介绍第11题,主要包括第11题使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

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)

python = 95
english = 92
c = 89
sub = python - c
avg = (python + english + c) / 3
print("Python课程和C语言课程的分数之差:"+ str(sub) + "分\n")
print("3门课的平均分:" + str(avg) + "分\n")
print("学号:3123")

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 >= c的结果:" + str(python >= c))
print("\n学号:3123")

print("\n手机店正在打折,活动进行中……")
strWeek = input("请输入中文星期(如星期一):")
intTime = int(input("请输入时间中的小时 (范围:0~23):"))
# 判断是否满足活动参与条件 (使用了if语句)
if (strWeek == '星期二' and (intTime >=10 and intTime <= 11)) or (strWeek == "星期五" and (intTime >= 14 and intTime <= 15)):
print("恭喜您,获得了折扣活动参与资格,快快选购吧!")
else:
print("对不起,您来晚了一步,期待下次活动……")
print("学号:3123")

fq = open(r'D:\mot.text','a+')
print("命运给予我们的不是失望之酒,而是机会之杯。",file=fq)
fq.close()

原文地址:https://www.cnblogs.com/cyt423017/p/15292895.html