Advertisement
HristoBaychev

World Swimming Record

Jan 28th, 2023
686
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. import math
  2.  
  3. record_in_sec = float(input())
  4. distance_in_meter = float(input())
  5. time_in_sec_swim = float(input())
  6.  
  7. distance_swim = distance_in_meter * time_in_sec_swim
  8.  
  9. resistance_swim = math.floor(distance_in_meter / 15)
  10. total_resistance = (resistance_swim * 12.5)
  11.  
  12. total_time_swim = distance_swim + total_resistance
  13.  
  14. if record_in_sec <= total_time_swim:
  15.     more_need_time = abs(record_in_sec - total_time_swim)
  16.     print(f'No, he failed! He was {more_need_time:.2f} seconds slower.')
  17. else:
  18.     print(f'Yes, he succeeded! The new world record is {total_time_swim:.2f} seconds.')
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement