Conteúdo do Curso
Intermediate Python Techniques
Intermediate Python Techniques
2. Arguments in Function
3. Function as an Argument
Challenge: Average Mark
Tarefa
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.
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 2. Capítulo 3
Challenge: Average Mark
Tarefa
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.
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 2. Capítulo 3