daily pastebin goal
7%
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # -*- coding:utf-8 -*-
  2. import datetime
  3. d1 = datetime.datetime(2018, 3, 21)
  4. d2 = datetime.datetime(2018, 5, 20)
  5. d3 = datetime.datetime(2018, 6, 11)
  6. dd1 = (d2-d1).days
  7. dd2 = (d3-d2).days
  8.  
  9. # 3月是4户交钱
  10. price1_per_day = 400.0/dd1/4
  11. # 5月是3户交钱
  12. price2_per_day = 300.0/dd2/3
  13.  
  14. print '3月是4户交钱'
  15. print '5月是3户交钱'
  16. print '实际范围: ~%s ~%s' % (d2.strftime('%Y-%m-%d'), d3.strftime('%Y-%m-%d'))
  17. print '单价/天/户: %.2f' % price1_per_day, '%.2f' % price2_per_day
  18.  
  19. room_1_d = datetime.datetime(2018, 3, 17)
  20. room_1_fee = price1_per_day * (d2 - room_1_d).days + price2_per_day * (d3 - d2).days
  21.  
  22. room_2_d = datetime.datetime(2018, 5, 17)
  23. room_2_fee = price2_per_day * (d3 - room_2_d).days
  24.  
  25. print '补缴费1 %s: %.2f' % (room_1_d.strftime('%Y-%m-%d'), room_1_fee)
  26. print '补缴费2 %s: %.2f' % (room_2_d.strftime('%Y-%m-%d'), room_2_fee)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top