Advertisement
Guest User

pagesLeft.py

a guest
Feb 11th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. #!/usr/bin/env python3
  2. #pagesLeft.py
  3.  
  4. #c = total pages of book.
  5.  
  6. a = input('How many pages have you read?\n')
  7. b = input('How many days do you have left?\n')
  8. a1 = int(a)
  9. b1 = int(b)
  10. c = 1019
  11. d = str((c - a1) / b1)
  12.  
  13. if d.endswith('.0'):
  14.     e = int((c - a1) / b1)
  15. else:
  16.     e = int((c - a1) / b1 + 1)
  17.  
  18. print('''\nYou have %s days left to read %s pages:
  19. That is %s pages per day to finish your book.''' % (b, a, e))
  20.  
  21. #####
  22.  
  23. # Just some notes on float values I had to fix for my purposes.
  24. #245 / 18 == 43
  25. #245 / 18 =/= 43.0
  26.  
  27. #800 / 18 =/= 12
  28. #800 / 18 =/= 12.166666666666666
  29. #800 / 18 == 13
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement