Challenge: Calculating the Average Mark with *args
Uppgift
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.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 2. Kapitel 3
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Awesome!
Completion rate improved to 3.7
Challenge: Calculating the Average Mark with *args
Svep för att visa menyn
Uppgift
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.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 2. Kapitel 3
single