Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- target_height = int(input())
- start_height = target_height - 30
- unsuccessful_tries = 0
- total_tries = 0
- while unsuccessful_tries < 3 and start_height <= target_height:
- try_height = int(input())
- if start_height > target_height:
- total_tries += 1
- break
- for tries in range(3):
- if try_height > start_height:
- start_height += 5
- total_tries += 1
- unsuccessful_tries = 0
- break
- elif try_height <= start_height:
- unsuccessful_tries += 1
- total_tries += 1
- if unsuccessful_tries == 3:
- break
- elif unsuccessful_tries < 3:
- try_height = int(input())
- if unsuccessful_tries == 3:
- print(f"Tihomir failed at {start_height}cm after {total_tries} jumps.")
- if start_height > target_height:
- print(f"Tihomir succeeded, he jumped over {start_height - 5}cm after {total_tries} jumps.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement