Challenge: Calculating the Average Mark with *args
Taak
Swipe to start coding
Let's calculate the average mark for the student. Each student has a different number of marks, so we don't know how many arguments will be passed to the function.
- Set the first positional argument as
namein theaverage_markfunction; - For other arguments use
*args; - In the equation that counts the
markvariable useargswithout*; - In the
printstatement usenameandmarkvariables.
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 2. Hoofdstuk 3
single
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Suggested prompts:
Vat dit hoofdstuk samen
Explain code
Explain why doesn't solve task
Awesome!
Completion rate improved to 3.7
Challenge: Calculating the Average Mark with *args
Veeg om het menu te tonen
Taak
Swipe to start coding
Let's calculate the average mark for the student. Each student has a different number of marks, so we don't know how many arguments will be passed to the function.
- Set the first positional argument as
namein theaverage_markfunction; - For other arguments use
*args; - In the equation that counts the
markvariable useargswithout*; - In the
printstatement usenameandmarkvariables.
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 2. Hoofdstuk 3
single