Advertisement
HristoBaychev

High Jump

Feb 12th, 2023
774
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. desire_jump = int(input())
  2.  
  3. current_jump = 0
  4. starting_jump = desire_jump - 30
  5. jump_counter = 0
  6. jump_fail_counter = 0
  7. high_jump = False
  8.  
  9. jump = int(input())
  10. while True:
  11.     jump_counter += 1
  12.     if jump > desire_jump:
  13.         high_jump = True
  14.         break
  15.  
  16.     if jump <= starting_jump:
  17.         jump_fail_counter += 1
  18.         if jump_fail_counter == 3:
  19.             print(f"Tihomir failed at {starting_jump}cm after {jump_counter} jumps.")
  20.             break
  21.  
  22.     if jump > starting_jump:
  23.         starting_jump += 5
  24.         jump_fail_counter = 0
  25.  
  26.     jump = int(input())
  27.  
  28. if high_jump:
  29.     print(f"Tihomir succeeded, he jumped over {desire_jump}cm after {jump_counter} jumps.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement