Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- target_height = int(input())
- current_height = target_height - 30
- fails = 0
- total_jumps = 0
- while fails < 3 and current_height <= target_height:
- jump = int(input())
- total_jumps += 1
- if jump > current_height:
- current_height += 5
- fails = 0
- else:
- fails += 1
- if current_height <= target_height:
- print(f"Tihomir failed at {current_height}cm after {total_jumps} jumps.")
- else:
- print(f"Tihomir succeeded, he jumped over {target_height}cm after {total_jumps} jumps.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement