Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: Snake and Sum | Function Arguments in Details
Mastering Python: Annotations, Errors and Environment
course content

Зміст курсу

Mastering Python: Annotations, Errors and Environment

Mastering Python: Annotations, Errors and Environment

1. Annotations
2. Function Arguments in Details
3. Error Handling
4. Virtual Environment

Challenge: Snake and Sum

Завдання

Implement the function that can take optional arguments and keyword arguments. This function should return the snake string and summary of integer values.

  1. Define the snake_and_sum() function that should take many arguments and keyword arguments.
  2. 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.
  3. 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.
  4. The snake_and_sum() function returns a tuple with two values (string and integer). Unpack these values to the variables string and result.

Завдання

Implement the function that can take optional arguments and keyword arguments. This function should return the snake string and summary of integer values.

  1. Define the snake_and_sum() function that should take many arguments and keyword arguments.
  2. 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.
  3. 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.
  4. The snake_and_sum() function returns a tuple with two values (string and integer). Unpack these values to the variables string and result.

Все було зрозуміло?

Секція 2. Розділ 6
toggle bottom row

Challenge: Snake and Sum

Завдання

Implement the function that can take optional arguments and keyword arguments. This function should return the snake string and summary of integer values.

  1. Define the snake_and_sum() function that should take many arguments and keyword arguments.
  2. 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.
  3. 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.
  4. The snake_and_sum() function returns a tuple with two values (string and integer). Unpack these values to the variables string and result.

Завдання

Implement the function that can take optional arguments and keyword arguments. This function should return the snake string and summary of integer values.

  1. Define the snake_and_sum() function that should take many arguments and keyword arguments.
  2. 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.
  3. 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.
  4. The snake_and_sum() function returns a tuple with two values (string and integer). Unpack these values to the variables string and result.

Все було зрозуміло?

Секція 2. Розділ 6
toggle bottom row

Challenge: Snake and Sum

Завдання

Implement the function that can take optional arguments and keyword arguments. This function should return the snake string and summary of integer values.

  1. Define the snake_and_sum() function that should take many arguments and keyword arguments.
  2. 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.
  3. 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.
  4. The snake_and_sum() function returns a tuple with two values (string and integer). Unpack these values to the variables string and result.

Завдання

Implement the function that can take optional arguments and keyword arguments. This function should return the snake string and summary of integer values.

  1. Define the snake_and_sum() function that should take many arguments and keyword arguments.
  2. 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.
  3. 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.
  4. The snake_and_sum() function returns a tuple with two values (string and integer). Unpack these values to the variables string and result.

Все було зрозуміло?

Завдання

Implement the function that can take optional arguments and keyword arguments. This function should return the snake string and summary of integer values.

  1. Define the snake_and_sum() function that should take many arguments and keyword arguments.
  2. 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.
  3. 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.
  4. The snake_and_sum() function returns a tuple with two values (string and integer). Unpack these values to the variables string and result.

Секція 2. Розділ 6
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt