Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- name = input()
- winner = ""
- points = 0
- while name != "Stop":
- sum = 0
- for i in range(len(name)):
- num = int(input())
- if num == ord(name[i]):
- sum += 10
- else:
- sum += 2
- if sum >= points:
- winner = name
- points = sum
- name = input()
- print(f"The winner is {winner} with {points} points!")
- Решение с тернарен оператор:
- name = input()
- winner = ""
- points = 0
- while name != "Stop":
- sums = 0
- for i in range(len(name)):
- sums += 10 if int(input()) == ord(name[i]) else 2
- winner = name if sums >= points else winner
- points = sums if sums >= points else points
- name = input()
- print(f"The winner is {winner} with {points} points!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement