Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- best_player = ''
- goals = 0
- command = input()
- while command != "END":
- goal = int(input())
- if goal > goals:
- best_player = command
- goals = goal
- if goals >= 10:
- break
- command = input()
- print(f'{best_player} is the best player!')
- if goals < 3:
- print(f'He has scored {goals} goals.')
- else:
- print(f'He has scored {goals} goals and made a hat-trick !!!')
- Решение с while и тернарен оператор:
- best_player = ''
- goals = 0
- command = input()
- while command != "END":
- goal = int(input())
- best_player = command if goal > goals else best_player
- goals = goal if goal > goals else goals
- if goals >= 10:
- break
- command = input()
- print(f'{best_player} is the best player!')
- print(f'He has scored {goals} goals{"." if goals < 3 else " and made a hat-trick !!!"}')
- Решение с for и тернарен оператор :
- import sys
- best_player = ''
- goals = 0
- for i in range(sys.maxsize-1):
- command = input()
- if command == "END":
- break
- goal = int(input())
- best_player = command if goal > goals else best_player
- goals = goal if goal > goals else goals
- if goals >= 10:
- break
- print(f'{best_player} is the best player!')
- print(f'He has scored {goals} goals{"." if goals < 3 else " and made a hat-trick !!!"}')
Add Comment
Please, Sign In to add comment