Python · Exercise 1 of 6Next
Beginner
Write a greeting function
Write a function greet(name, greeting="Hello") that returns text like Hello, Asha!: the greeting, a comma and a space, the name, and an exclamation mark.
It must return the text, not print it. Replace the pass line with your code. The last line of the starter already prints greet("Asha"), so leave it as it is.
What Check tests
greet("Asha")returnsHello, Asha!greet("Ravi", "Hi")returnsHi, Ravi!- A keyword call works
- Keywords work in any order, and the default is not changed
- It returns a string and does not just print
- The program prints
Hello, Asha!
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
main.py
Sign in to run your code.
Output
Press Run to see what your program prints.