Advertisement
yordan_yordanov

06. High Jump

Aug 26th, 2020
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. goal = int(input())
  2. starting_goal = goal - 30
  3. failed_attempts = 0
  4. counter = 0
  5.  
  6. while True:
  7.     current_jump = int(input())
  8.  
  9.     if current_jump <= starting_goal:
  10.         failed_attempts += 1
  11.         counter += 1
  12.     elif current_jump > starting_goal:
  13.         starting_goal += 5
  14.         failed_attempts = 0
  15.         counter += 1
  16.  
  17.     if failed_attempts == 3:
  18.         print(f'Tihomir failed at {starting_goal}cm after {counter} jumps.')
  19.         break
  20.  
  21.     if current_jump >= goal:
  22.         print(f'Tihomir succeeded, he jumped over {current_jump}cm after {counter} jumps.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement