

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: Errors and Exceptions in Python
incomplete
2: Try/Except Review
incomplete
3: Raising Your Own Exceptions
incomplete
4: Raising Exceptions Review
incomplete
5: Different Types of Exceptions
incomplete
6: Raising Exceptions Review
incomplete
7: Raising Exceptions Review
incomplete
8: Raising Exceptions Review
incomplete
9: Purchase Bug
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
There's a bug in the merchant system that allows players to buy items from the shop even when they don't have enough gold.
Complete the purchase_item function.
If the character doesn't have enough gold, raise an Exception with the text not enough gold.
Otherwise, return the amount of remaining money the customer has after completing the purchase.
Raise the exception but don't worry about handling it; that's up to the caller (i.e., the tests).