

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Unit Tests
incomplete
2: Two Lesson Types
incomplete
3: Debugging
incomplete
4: Learning Effectively
incomplete
5: Debugging Practice
incomplete
6: Stack Trace
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
When you're working as a professional developer, you'll typically write code on your computer and test it by yourself before it's deployed to users.
That first part of the process is called debugging. You write some code, run it, and if it doesn't work, you fix the bugs. You repeat this process until you're confident that your code works as expected.
At Boot.dev, the Run button is for debugging. The Submit button mimics the idea of publishing your code for production use.
You should be debugging your code using the Run button. You should be adding print() statements to your code to make sure it's doing what you think it's doing at different points in the code.
print() the value you calculatedYou will never lose XP or be penalized on Boot.dev for using the run button. However, there are consequences for submitting broken code, just like there are career consequences for pushing broken code to your users!
When you use the Run button, a few tests will run against your code. However, the Submit button will run additional tests that you're not able to debug against. That's what keeps it fun and realistic (it's so hard to know what your users will do with your code!).
Complete the take_magic_damage function. It should return the new health after calculating how much magic-type damage the player takes. Here is a description of the parameters:
health: The player's starting healthresist: The player's magic resistance. This reduces the damage they take by a static amountamp: The attacker's magic amplification. This increases the damage they deal by a multiplierspell_power: The base damage of the spellFirst, calculate the total maximum damage to be inflicted by multiplying the spell_power by the amp. Then, subtract the resist from the total damage to get the actual damage dealt. Apply that damage to the player's health and return the new health.