PROBLEM 100
Hard

Personal Assistant

Programming Basics · Python

</>
STATUS Not solved

TASK

Problem

#100

Given `hour`, `temp`, and rain flag. Choose greeting: GOOD MORNING through 11, GOOD AFTERNOON through 17, else GOOD EVENING. Append advice after ` | `: TAKE UMBRELLA if raining, else WEAR JACKET if temp<10, else HAVE A NICE DAY.

EXAMPLE

Example

Input
8 5 0
Output
GOOD MORNING | WEAR JACKET

LIMITS

Constraints

0≤hour≤23; -50≤temp≤50; rain∈{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`. `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 `g` shows how this idea is applied to the task data.

💡
NEED HELP? Hints
+

['Solve in two stages: greeting, then advice, then combine.']

ANSWER Solution
+
h, t, r = map(int, input().split())
if h <= 11:
    g = 'GOOD MORNING'
elif h <= 17:
    g = 'GOOD AFTERNOON'
else:
    g = 'GOOD EVENING'
if r == 1:
    a = 'TAKE UMBRELLA'
elif t < 10:
    a = 'WEAR JACKET'
else:
    a = 'HAVE A NICE DAY'
print(g, '|', a)