【python】广州地铁9月1号更新之后预估消费计算

广州地铁9月1号更新之后预估消费计算

import math
#第一步,计算到达80元需要多少次数,实际消费多少钱
total_count=int(input("请输入你每月通勤天数:"))*2#按照21天上班,实际往返42次
one_price=int(input("输入你的单程价格:")) #单程价格6元
a=one_price*total_count
def reach_80():
    if a<80:
        print("没有达到优惠金额,本月实际消费预计%d元"%(a))
        return
    price_80_count=math.ceil(80/one_price)
    price_80=one_price*price_80_count
    return reach_200(price_80,price_80_count)

def reach_200(price_80,price_80_count):
    price_200_count=math.ceil((200-price_80)/(one_price*0.8))
    price_200=price_200_count*(one_price*0.8)
    b=(total_count-price_80_count)*(one_price*0.8)+price_80
    if price_200_count>(total_count-price_80_count):
        print("没有达到200优惠金额,本月实际消费预计%s元"%(b))
        return
    remain_count=total_count-price_80_count-price_200_count
    print("达到最大优惠,本月实际消费预估%s元"%(round(remain_count*(one_price*0.5)+price_80+price_200)))



reach_80()
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值