Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- steps = 0
- while steps < 10000:
- command = input()
- if command == 'Going home':
- steps += int(input())
- break
- steps += int(command)
- if steps < 10000:
- print(f'{10000 - steps} more steps to reach goal.')
- else:
- print(f'Goal reached! Good job!')
- ИЛИ:
- steps = 10000
- while steps > 0:
- command = input()
- if command == 'Going home':
- steps -= int(input())
- break
- steps -= int(command)
- if steps > 0:
- print(f'{steps} more steps to reach goal.')
- else:
- print(f'Goal reached! Good job!')
- РЕШЕНИЕ С ТЕРНАРЕН ОПЕРАТОР:
- steps = 10000
- while steps > 0:
- command = input()
- steps -= int(command) if command != 'Going home' else int(input())
- if command == 'Going home':
- break
- print(f'{steps} more steps to reach goal.' if steps > 0 else f'Goal reached! Good job!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement