第二章心得
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("3106")
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("3106")
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("3106")
运行结果:
06
print("手机店现有折扣活动,速来抢购!!")
strweek = input("请输入进入手机店的星期(如星期一):")
if(strweek=="星期二 " and (inttime >=10 and inttime <=11)) or(strweek =="星期五" and (inttime >=14 and inttime <=15)):
print("恭喜您,获得了折扣活动参与资格,快快选购!")
else:
print("sorry,没机会了")
print("3106")