Arksiana

6. High Jump /without while TRUE

Nov 12th, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. height = int(input())
  2. starting = height - 30
  3. fail = 0
  4. counter = 0
  5. failed = False
  6. while starting <= height:
  7.     jump = int(input())
  8.     counter += 1
  9.  
  10.     if jump <= starting:
  11.         fail += 1
  12.         if fail == 3:
  13.             failed = True
  14.             break
  15.     else:
  16.         # if starting >= height:
  17.             # break
  18.         starting += 5
  19.         fail = 0
  20.  
  21.  
  22. if not failed:
  23.     print(f"Tihomir succeeded, he jumped over {starting - 5}cm after {counter} jumps.")
  24.  
  25. else:
  26.     print(f"Tihomir failed at {starting}cm after {counter} jumps.")
  27.  
Advertisement
Add Comment
Please, Sign In to add comment