

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 5
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
You've probably noticed that a variable needs to be declared before it's used. For example, the following doesn't work:
print(my_name)
my_name = "Lane Wagner"
# NameError: 'my_name' is not defined
It needs to be:
my_name = "Lane Wagner"
print(my_name)
# Lane Wagner
Code executes in order from top to bottom, so a variable needs to be created before it can be used. That means that if you define a function, you can't call that function until after it has been defined.
There's a bug! It looks like we are trying to call a function before it was defined! Run the code and read the printed error, then fix it.
You don't need to add any new functions or pass any inputs. Calling a function with empty parentheses is perfectly valid. Pay attention to where main() is being called.