Lesson 9 of 55
PythonFunctions
20 minutes
Course progress16%
What you'll learn
Keep these ideas in mind as you work through the lesson.
Lesson 9 of 55
Python20 minutes
Keep these ideas in mind as you work through the lesson.
Functions are reusable blocks of code that you can call with arguments. Define a function using the def keyword followed by a name and optional parameters.
def greet(name):
return f'Hello, {name}!'
print(greet('Bob'))
A return statement sends a value back to the caller. If a function reaches the end without return, it implicitly returns None.