SHARE
TWEET

Untitled

a guest Oct 13th, 2019 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. height_needed = int(input())
  2.  
  3. starting_height = height_needed - 30
  4. counter_height = height_needed
  5. unsuccessful_try = 0
  6. total_jumps = 0
  7.  
  8. while True:
  9.     jump = int(input())
  10.     total_jumps += 1
  11.     if jump >= height_needed:
  12.         break
  13.  
  14.     if jump > starting_height:
  15.         starting_height += 5
  16.         unsuccessful_try = 0
  17.     else:
  18.         unsuccessful_try += 1
  19.         if unsuccessful_try == 3:
  20.             break
  21.  
  22. if not unsuccessful_try == 3:
  23.     print(f'Tihomir succeeded, he jumped over {height_needed}cm after {total_jumps} jumps.')
  24. else:
  25.     print(f'Tihomir failed at {starting_height}cm after {total_jumps} jumps.')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top