*args and **kwargs in Python

def add_to_numbers(num1, num2):
print(num1 + num2)
def add_any_numbers(*args):
total = 0
for number is args:
total +=number
print("Total sum is: ", total)
def print_stuff(**kwargs):
print(kwargs)
print_stuff(a=1, b=2, c="Hello World")this returns:{'a': 1, 'b': 2, 'c': "Hello World"}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store