Advertisement
svephoto

High Jump [python]

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