Competition Winner
Programming Basics · Python
TASK
Problem
Given scores `a` and `b`; higher score wins. Print `FIRST`, `SECOND`, or `DRAW`.
EXAMPLE
Example
15 12
FIRST
LIMITS
Constraints
All integer inputs have absolute value at most 10^9; any additional relationships between them are stated directly in the task.
LEARN
Theory for this problem
+
`input()` reads data entered by the user. The result of `input()` is initially a string. `split()` separates one input line into individual values using spaces. `map()` applies the specified conversion to each input value. Comparison operators `==`, `!=`, `<`, `>`, `<=`, `>=` compare values and produce `True` or `False`. `if` checks a condition and runs its block when the condition is true. `else` runs when the corresponding `if` condition is false. `print()` displays the program result. Print only what the problem statement requires.
**Connection to this task.** An `if` statement chooses a program branch from a Boolean condition. Comparisons produce `True` or `False`, and `elif` lets you test several mutually exclusive cases in order. The expression `'FIRST'` shows how this idea is applied to the task data.
NEED HELP?
Hints
+
['Compare scores and handle a draw separately.']
ANSWER
Solution
+
a, b = map(int, input().split())
if a > b:
print('FIRST')
elif b > a:
print('SECOND')
else:
print('DRAW')