Course Content
Python Functions Tutorial
Python Functions Tutorial
Challenge: Building Functions
Let's introduce ourselves. I've written a function that outputs my name, and your task is to write a function that outputs your name.
# Define the function `say_my_name` def say_my_name(): # The function prints the string `My name is Heisenberg` print('My name is Heisenberg') # Call the function `say_my_name` say_my_name()
The say_my_name
function simply prints the phrase 'My name is Heisenberg'
to the screen, and we can call this function to see this output.
Swipe to show code editor
You have to write a function that prints your name in the console. This function must have no parameters and no return value. The name of the function must be print_name
.
Once you've completed this task, click the button below the code to check your solution.
Thanks for your feedback!
Challenge: Building Functions
Let's introduce ourselves. I've written a function that outputs my name, and your task is to write a function that outputs your name.
# Define the function `say_my_name` def say_my_name(): # The function prints the string `My name is Heisenberg` print('My name is Heisenberg') # Call the function `say_my_name` say_my_name()
The say_my_name
function simply prints the phrase 'My name is Heisenberg'
to the screen, and we can call this function to see this output.
Swipe to show code editor
You have to write a function that prints your name in the console. This function must have no parameters and no return value. The name of the function must be print_name
.
Once you've completed this task, click the button below the code to check your solution.
Thanks for your feedback!