广州地铁9月1号更新之后预估消费计算
import math
total_count=int(input("请输入你每月通勤天数:"))*2
one_price=int(input("输入你的单程价格:"))
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()