Challenge: Building Functions
Write a function that outputs your name just as the example function outputs my name.
1234567# 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 prints the phrase 'My name is Heisenberg' to the screen. You can call this function to display the output.
Swipe to start coding
Write a function that prints your name in the console.
- Define a function named
print_name. - Inside the function, use
print()to output a string with your name in the format:My name is {your name}, where{your name}is replaced with your actual name.
Solution
Thanks for your feedback!
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Can you show me how to write the function that outputs your name?
What should I change in the example to make it print a different name?
Can you explain how function calls work in this example?
Awesome!
Completion rate improved to 4.17
Challenge: Building Functions
Swipe to show menu
Write a function that outputs your name just as the example function outputs my name.
1234567# 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 prints the phrase 'My name is Heisenberg' to the screen. You can call this function to display the output.
Swipe to start coding
Write a function that prints your name in the console.
- Define a function named
print_name. - Inside the function, use
print()to output a string with your name in the format:My name is {your name}, where{your name}is replaced with your actual name.
Solution
Thanks for your feedback!
single