Teo_Yanchev

high_jump_9-10-2019_exam

Jul 15th, 2020
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. high = int(input())
  2.  
  3. start = high - 30
  4. total_jumps = 0
  5. unsucc_jump = 0
  6.  
  7. while True:
  8. jump = int(input())
  9. total_jumps += 1
  10.  
  11. if jump > start:
  12. start += 5
  13. unsucc_jump = 0
  14. else:
  15. unsucc_jump += 1
  16.  
  17. if start > high:
  18. print(f"Tihomir succeeded, he jumped over {start-5}cm after {total_jumps} jumps.")
  19. break
  20. if unsucc_jump == 3:
  21. print(f"Tihomir failed at {start}cm after {total_jumps} jumps.")
  22. break
Advertisement
Add Comment
Please, Sign In to add comment