← Back to If Statements
Question 235
Loud Or Quiet Greeting
Loud Or Quiet Greeting
Read a name and then a yes or no answer to whether the greeting should be loud. Build the greeting with the conditional expression a if condition else b: HELLO, <name> when the answer is yes, otherwise Hello, <name>, each made with an f-string. Store it in a variable named greeting and print it. Input: two lines, the name then the answer, no prompts. Output: one line.
Expected Output:
HELLO, Maya= newline. The output ends with a newline — print one after the last line.
Hints2 available
Sign in to use hintsTopics:
If StatementsOperators
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.