Free Delivery
Programming Basics · Python
TASK
Problem
Given order `amount` and `premium` flag 0/1. Delivery is free if amount≥3000 or premium is active.
EXAMPLE
Example
1200 1
FREE
LIMITS
Constraints
amount ≥ 0; premium ∈ {0,1}
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`. `or` requires at least one condition to be true. `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 `'FREE'` shows how this idea is applied to the task data.
NEED HELP?
Hints
+
['Only one condition is enough, so use `or`.']
ANSWER
Solution
+
a, p = map(int, input().split())
if a >= 3000 or p == 1:
print('FREE')
else:
print('PAID')