Testing your code is a good idea because it usually leads to great improvements. There's many libraries in python that will help with testing but a favourable on called pytest. In this series of videos we demonstrate how the use it.
test_blackjack.py now has more tests.
from blackjack import card_score def test_simple_usecase1(): card_score("JK") == 20 def test_simple_usecase2(): card_score("JKQ") == 0 def test_simple_usecase3(): card_score("KA") == 21
Before watching the next video, can you spot the bug?
Feedback? See an issue? Something unclear? Feel free to mention it here.
If you want to be kept up to date, consider getting the newsletter.