

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 4
click for more info
Not enough gems
Cost: 6 gems
1: Functions
incomplete
2: Function Review
incomplete
3: Multiple Parameters
incomplete
4: Printing vs. Returning
incomplete
5: Where to Declare Functions
incomplete
6: Order of Functions
incomplete
7: Community
incomplete
8: Boots Interview
incomplete
9: Solutions
incomplete
10: None Return
incomplete
11: Multiple Return Values
incomplete
12: Parameters vs. Arguments
incomplete
13: Default Values
incomplete
14: Curse
incomplete
15: The Training Grounds
incomplete
16: Enchant and Attack
incomplete
17: Archmage
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Some new developers get hung up on the difference between print() and return.
It can be particularly confusing when the test suite we provide simply prints the output of your functions to the console. It makes it seem like print() and return are interchangeable, but they are not!
print() is a function that:
def print_alchemy():
print("equivalent exchange")
printed_alchemy = print_alchemy()
# equivalent exchange
print(printed_alchemy)
# None
return is a keyword that:
print()ed)def return_transmutation():
return "nothing is lost"
returned_transmutation = return_transmutation()
print(returned_transmutation)
# nothing is lost
Printing values and running your code is a great way to debug your code. You can see what values are stored in various variables, find your mistakes, and fix them. Add print statements and run your code as you go! It's a great habit to get into to make sure that each line you write is doing what you expect it to do.
In the real world it's rare to leave print() statements in your code when you're done debugging. Similarly, you need to remember to remove any print() statements from your code before submitting your work here on Boot.dev because it will interfere with the tests!
There's a problem in the get_title function! It's supposed to construct the title value and return it to the caller. Instead, it's barbarically printing the value to the console.
Fix the get_title function.