

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
Not enough gems
Cost: 6 gems
1: Number Sum
incomplete
2: Find Min
incomplete
3: Remove Non-Integers
incomplete
4: Factorial
incomplete
5: Area Sum
incomplete
6: List Division
incomplete
7: Join Strings
incomplete
8: Unit Tests
incomplete
9: Fix a Failing Test
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
We have a failing test case for our avg_luck_boost function! When an empty list is passed to the function, it should return 0.0. Instead, it tries to divide by zero and crashes.
Let's update avg_luck_boost so that all tests pass again.
Some programmers like to work this way; it's called "test-driven development" (TDD):
Stub out a function.
Write tests that expect the correct behavior of that function.
Run the tests (they should fail).
Implement the function and keep updating it until it passes the tests.
TDD is sometimes a controversial topic, and we won't dive into that here. But we will give you much more practice with writing tests in later courses.
Fix the avg_luck_boost function in main.py.