Advertisement
Spocoman

Workout

Feb 16th, 2022 (edited)
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.91 KB | None | 0 0
  1. import math
  2.  
  3. days = int(input())
  4. kilometers = float(input())
  5. total_kilometers = kilometers
  6.  
  7. for i in range(days):
  8.     percentage = float(input())
  9.     kilometers *= (100 + percentage) / 100
  10.     total_kilometers += kilometers
  11.  
  12. if total_kilometers < 1000:
  13.     print(f"Sorry Mrs. Ivanova, you need to run {1000 - math.floor(total_kilometers)} more kilometers")
  14. else:
  15.     print(f"You've done a great job running {math.ceil(total_kilometers) - 1000} more kilometers!")
  16.  
  17.  
  18. ИЛИ:
  19.  
  20. days = int(input())
  21. kilometers = float(input())
  22. total_kilometers = 1000 - kilometers
  23.  
  24. for i in range(days):
  25.     kilometers *= (100 + float(input())) / 100
  26.     total_kilometers -= kilometers
  27.  
  28. if total_kilometers > 0:
  29.     print(f"Sorry Mrs. Ivanova, you need to run {int(total_kilometers + 0.99)} more kilometers")
  30. else:
  31.     print(f"You've done a great job running {int(abs(total_kilometers) + 0.99)} more kilometers!")
  32.    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement