网购_python3

网购

http://www.nowcoder.com/questionTerminal/5d7dfd405e5f4e4fbfdff6862c46b751

def discount(price, isDiscount):
    if isDiscount:
        price -= 50
    return price if price > 0 else 0    
while True:
    try:
        price, month, day, isDiscount = map(float, input().split())
        result = price
        if month == 11 and day == 11:
            print('{:.2f}'.format(discount(result*0.7, isDiscount)))
        elif month == 12 and day == 12:
            print('{:.2f}'.format(discount(result*0.8, isDiscount)))
        else:            
            print('{:.2f}'.format(result))
    except EOFError:
        break
全部评论

相关推荐

迷茫的大四🐶:💐孝子启动失败,改为启动咏鹅
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务