Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

variable-length arguments(*args)

# function with variable-length arguments
def percentage(*args):
    sum = 0
    for i in args:
        # get total
        sum = sum + i
    # calculate average
    avg = sum / len(args)
    print('Average =', avg)

percentage(56, 61, 73)
Source by pynative.com #
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
9+9 =