Main content
Course: Intro to computer science - Python > Unit 4
Lesson 2: Function control flowChallenge: Sweet scores
Instructions
Step 1
Handle poison apples
Aiyana designed a fruit-themed card game, where cards can either be apples or bananas. She’s working on a scoring system, which she’s split into functions.
Aiyana’s deck contains a single poison apple card. Normally, each apple card scores 2 points, but if a player has the poison apple, each of their apple cards scores -2 points!
- Update the
get_apple_score()
function body to include the poison apple rule in its score calculation.
You’ll need to use the boolean has_poison_apple
parameter, which contains True
if the player has the poison apple card.