Say Hello
Beginner · Write the code · from Python Functions: Define, Call, and Return Values
From the lesson: Python Functions: Define, Call, and Return Values
Imagine you have a favorite recipe for pancakes. Every Sunday morning, you follow the same steps: mix flour, crack eggs, pour batter, flip. You don't reinvent the recipe each time - you just follow the one you already know.
Read the lessonWrite a function called say_hello that takes a name parameter and prints Hello, <name>! (with the exclamation mark). For example, say_hello('World') should print Hello, World!.
# Define your function here
# Test it
say_hello('World')
say_hello('Python')
What Check runs
Your code runs first, then each of these lines. The output must match exactly.
| Runs | Expected output |
|---|---|
| say_hello('World') | Hello, World! |
| say_hello('Python') | Hello, Python! |
| say_hello('Ada') | Hello, Ada! |
More Function exercises
- Predict the OutputBeginner
- Area of a RectangleBeginner
- Fix the Broken FunctionIntermediate
- Temperature ConverterIntermediate
- Build a Grade CalculatorAdvanced
All Python exercises · 50 practice problems · Functions quiz