第一周python作业

2022-12-03,,

print("hello world")
height=float(input("请输入你的身高:"))
weight=float(input("请输入你的体重:"))
bmi=weight/(height*height)
print("您的bmi指数为:"+str(bmi))
#判断身材是否合理
if bmi<18.5:
   print ("您的体重过轻,多吃点")
if bmi>=18.5 and bmi<=24.9:
   print ("正常范围,继续保持")
if bmi>24.9:
   print ("您的体重过重")
if bmi>29:
   print("fat")

print('''
                      学编程你不是一个人在战斗
                      |
             _ _\--_ _|_
ⅠⅠ=======00000【/ 007---|
           _____\______|/------.
           /___mingrisoft.com___|
            \◎ ◎ ◎ ◎ ◎ ◎ ◎ ◎ ◎ ◉/
              ~~~~~~~~~~~~~~~~~~
''')

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_all)
print("实收金额为:"+ money_all_str)

python=95
English=92
c=89
sub = python - c
avg = (python + English + c)/3
print("python课程和c语言课程的分数差:"+str(sub)+"分、n")
print("三门课的平均分:"+str(avg)+"分")

python = 95  #定义变量,存储python的分数
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手机店正在打折,活动进行中...")
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("hello world")
height=1.85
print("您的身高:" + str(height))
weight=65
print("您的体重:" + str(weight))
bmi=weight/(height*height)
print("您的bmi指数为:"+str(bmi))
#判断身材是否合理
if bmi<18.5:
   print ("您的体重过轻,多吃点")
if bmi>=18.5 and bmi<=24.9:
   print ("正常范围,继续保持")
if bmi>24.9:
   print ("您的体重过重")
if bmi>29:
   print("fat")

 

第一周python作业的相关教程结束。

《第一周python作业.doc》

下载本文的Word格式文档,以方便收藏与打印。