Advertisement
PowerCell46

High jump Python

Feb 1st, 2023
903
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. goal_jump_height = int(input())
  2. current_goal_jump_height = goal_jump_height - 30
  3. fail_counter = 0
  4. jump_counter = 0
  5.  
  6. while True:
  7.  
  8.     current_jump_height = int(input())
  9.     jump_counter += 1
  10.     if current_jump_height > goal_jump_height and current_goal_jump_height >= goal_jump_height:
  11.         print(f'Tihomir succeeded, he jumped over {current_goal_jump_height}cm after {jump_counter} jumps.')
  12.         break
  13.     if current_jump_height > current_goal_jump_height:
  14.         current_goal_jump_height += 5
  15.         fail_counter = 0
  16.     else:
  17.         fail_counter += 1
  18.         if fail_counter == 3:
  19.             print(f'Tihomir failed at {current_goal_jump_height}cm after {jump_counter} jumps.')
  20.             break
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement