2021-11-15 day 5

#单分支结构
money = 1000#余额
s=int(input('请输入取款金额'))
#判断余额是否足够
if money>=s:
    money=money-s
    print('取款成功,余额剩下:',money)
#双分支结构---------------------')
#if....else, 二选一
#写入一个数判断奇偶
num=int(input('请输入一个整数'))

if num%2==0:
    print(num,'是偶数')
else:
    print(num,'是奇数')
    
#多分支结构---------------------')
#写入一个整数成绩,
#90-100 A
#80-89  B
#70-79  C
#60-69  D
# 0-59  E
#小于0或大于100为非法数据
score = int(input('请输入一个整数成绩'))

if score>=90 and score<=100:
    print('A级')
elif score>=80 and score<=89:
    print('B级')
elif score >= 70 and score <= 79:
    print('C级')
elif score >= 60 and score <= 69:
    print('D级')
elif score >= 0 and score <= 59:
    print('E级')
else:
    print('对不起,成绩有误,不在有效范围内')

    #也可写成(python独有)
    if 90<=score<=100
    #等等

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值