Greeting with a Default
Python
15 pts
Greeting with a Default
Define make_greeting(name, greeting="Selam") that returns a string in this form:
Selam, Abel!
The greeting comes first, then a comma and a space, then the name and an exclamation mark. If no greeting is given, the default "Selam" is used.
Print make_greeting("Abel") and make_greeting("Merhawi", greeting="Good morning"). Expected output:
Selam, Abel! Good morning, Merhawi!
Checklist
- Define
make_greetingwith the parametersnameandgreeting, wheregreetinghas the default value"Selam". - Return (do not print) the greeting, a comma and a space, the name and an exclamation mark.
- Print the two calls given at the bottom.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
