python笔记(三):if循环语句

  -----学习视频来源于马士兵教育-----

内容主要为了自己复习用,也可以让大家梳洗思路

###if循环
money=1000
mrmb=int(input('输入取款金额:'))
if money>=mrmb:
    money=money-mrmb
    print('取款成功,余额为:',money)
else:
    money = money - mrmb
    print('取款失败',money)

#90-100  A
#80-89   B
#70-79   C
#60-69   D
#0-59    E
score=int(input('请输入一个数字0-100:'))
if score>=90 and score<=100:
#if 90<=score<=100:
    print('A')
elif score>=80 and score<=89:
# if 80<=score<=89:
    print('B')
elif score>=70 and score<=79:
# if 70<=score<=79:
    print('C')
elif score>=60 and score<=69:
# if 60<=score<=69:
    print('D')
elif score>0 and score<=59:
# if 0=score<=59: 
    print('E')
else:
    print('成绩不合格')


ans=input('是会员吗:') #是
money=float(input('请输入你的金额:')) #200
if ans=='yes':
    print('会员')
    if money>=200:
        print('8%',money*0.8) #160
    elif money>=100:
        print('7%',money*0.7)
    else:
        print('9%',money*0.9)
else:
    if money>500:
        print('ok',money*0.98)
    else:
        print('no会员',money)

#整合版if
a=int(input('nub1:')) #10
b=int(input('nub2:')) #20
print(str(a)+'>='+str(b) if a>=b else str(a)+'<'+str(b)) #10<20

##pass语句,什么都不用做,只是一个占位符,用到需要写语句的地方
money=1000
if money>=222:
    pass
else:
    pass
  • 5
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

三颗草丶

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值