Contenido del Curso
Intermediate Python Techniques
Intermediate Python Techniques
2. Arguments in Function
3. Function as an Argument
Challenge: Average Mark
Tarea
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
name
in theaverage_mark
function; - For other arguments use
*args
; - In the equation that counts the
mark
variable useargs
without*
; - In the
print
statement usename
andmark
variables.
Solución
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 2. Capítulo 3
Challenge: Average Mark
Tarea
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
name
in theaverage_mark
function; - For other arguments use
*args
; - In the equation that counts the
mark
variable useargs
without*
; - In the
print
statement usename
andmark
variables.
Solución
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 2. Capítulo 3