Contenido del Curso
Mastering Python: Annotations, Errors and Environment
Mastering Python: Annotations, Errors and Environment
Challenge: Snake and Sum
Tarea
Swipe to begin your solution
Implement the function that can take optional arguments and keyword arguments. This function should return the snake string and summary of integer values.
- Define the
snake_and_sum()
function that should take many arguments and keyword arguments. - Create a loop for iteration on optional arguments:
- if the argument is a string, append this value to the
snake
list. - if the argument is an integer, add this argument to the
summary
variable.
- if the argument is a string, append this value to the
- Create a loop for iteration on keyword arguments:
- all keywords are string, append it to the
snake
list. - if the value is an integer, add this value to the
summary
variable.
- all keywords are string, append it to the
- The
snake_and_sum()
function returns a tuple with two values (string and integer). Unpack these values to the variablesstring
andresult
.
Solución
Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 2. Capítulo 6
Challenge: Snake and Sum
Tarea
Swipe to begin your solution
Implement the function that can take optional arguments and keyword arguments. This function should return the snake string and summary of integer values.
- Define the
snake_and_sum()
function that should take many arguments and keyword arguments. - Create a loop for iteration on optional arguments:
- if the argument is a string, append this value to the
snake
list. - if the argument is an integer, add this argument to the
summary
variable.
- if the argument is a string, append this value to the
- Create a loop for iteration on keyword arguments:
- all keywords are string, append it to the
snake
list. - if the value is an integer, add this value to the
summary
variable.
- all keywords are string, append it to the
- The
snake_and_sum()
function returns a tuple with two values (string and integer). Unpack these values to the variablesstring
andresult
.
Solución
Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 2. Capítulo 6
Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones