2021.9.13第二周

2021/9/13 23:10:24

本文主要是介绍2021.9.13第二周,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

一.超市抹零

money_all =56.75+72.91+88.5+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+c+english)/3
print("python与c的分差为:"+str(sub)+"分")
print("平均分:"+str(avg)+"分")

 

 三.比较运算符

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("手机店在打折,活动进行中")
strweek=input("请输入中文日期:")
inttime=int(input("请输入小时:"))
if(strweek=="星期二"and (inttime>=10 and inttime<=11))or (strweek=="星期五"and(inttime>=14 and inttime<=15)):
print("恭喜你,获得抽奖资格")
else :
print("对不起,你来晚一步")

 

 学号......3121

 



这篇关于2021.9.13第二周的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程