Menu

Sign in to track your progress and unlock all features.

Theme style

Log in

Full lesson preview

Create a function that accepts any number of args

Use *args to accept a variable number of positional arguments and process them.

Python practice6 minFunctions & ScopeBeginnerLast updated March 17, 2026

Problem statement

Implement sum_all(*args) which accepts zero or more numeric positional arguments and returns their sum. The function should handle integers and floats and return 0 when called with no arguments.

Task

Write a function sum_all that accepts any number of positional numeric arguments and returns their sum. If no arguments are given, return 0.

Examples

Sum three numbers

Input

sum_all(1, 2, 3)

Output

6

1 + 2 + 3 equals 6.

Input format

A variable number of positional numeric arguments (ints or floats).

Output format

A single number: the sum of the provided arguments (0 if none).

Constraints

Do not use external libraries. The function should work with int and float inputs.

Samples

Sample 1

Input

sum_all()

Output

0

No arguments provided, so the sum is 0.