elif practice in jetbrains

在这里插入图片描述
在这里插入图片描述
my code:

Chicken = 23
Goat = 678
Pig = 1296
Cow = 3848
Sheep = 6769
money = int(input())

if money < 23:
    print("None")
elif money >= 23 and money < 678:
    if money < 23 * 2:
        print("1 chicken") 
    else:
        print(money // 23, "chickens")
elif money >= 678 and money <1296:
    if money < 678 * 2:
        print("1 goat")
    else:
        print(money // 678, "goats")
elif money >= 1296 and money < 3848:
    if money < 1296 * 2:
        print("1 pig")
    else:
        print(money // 1296, "pigs")
elif money >= 3848 and money < 6769:
    if money < 3848 * 2:
        print("1 cow")
    else:
        print(money // 3848, "cows")
elif money >= 6769:
    if money < 6769 * 2:
        print("1 sheep")
    else:
        print(money // 6769, "sheep")
money = int(input())
if money >= 23:
    if money < 678:
        print(money // 23, 'chicken' if money // 23 == 1 else 'chickens')
    elif money < 1296:
        print(money // 678, 'goat' if money // 678 == 1 else 'goats')
    elif money < 3848:
        print(money // 1296, 'pig' if money // 1296 == 1 else 'pigs')
    elif money < 6769:
        print(money // 3848, 'cow' if money // 3848 == 1 else 'cows')
    elif money >= 6769:
        print(money // 6769, 'sheep')
else:
    print('None') 

print (, “A” if … else “B”)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值