买iPhone13选某多多百亿补贴还是官网免息?我用Python帮你算好了!

total=float(input('分期金额:'))
date=int(input('分期月数:'))
expectedRate=float(input('预计持有资金收益年利率:'))
pddYouhui=float(input('补贴金额为:'))
monthRate=expectedRate/12
monthPay=total/date
monthPayIn=0
totalIn=0
print(f'每月应还{
      
      monthPay}')
for i in range(date):
    total -= monthPay
    monthPayIn = total*monthRate
    totalIn+=monthPayIn
    print(f'第{
      
      i}个月收益为{
      
      monthPayIn:.3}')


print(f'总收益为{
      
      totalIn}')
if totalIn>=pddYouhui:
    print('选择分期更划算')
else:
    print('选择PDD更划算')

写着玩的,各位有兴趣的可以看看

猜你喜欢

转载自blog.csdn.net/ftimes/article/details/120845281