

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. They seem 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:
printed)def return_transmutation():
return "nothing is lost"
returned_transmutation = return_transmutation()
print(returned_transmutation)
# nothing is lost
Printing values to the console is a great technique for debugging your code. By running the code, you can see what values are stored in variables, find your mistakes, and fix them. Add print statements and run your code as you go! Making sure that each line you write does what you expect is a great habit to get into.
In the real world, it's rare to leave print statements in your code when you're done debugging. Similarly, on Boot.dev you need to remember to remove any print statements from your code before submitting your work because it will fail 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.