# When applying the arguments, Python first fills in the positional arguments,
# then the keyword arguments.
# for example I have a function which has two arguments
def func(a, b):
print("a=", a)
print("b=", b)
#I will get an error if I call the function like this
func(a=5, 9) # 9 is the positional argument here. a is keyword argument
# correct way to call this function
func(5, 9) or func(5, b=9) or func(a=5, b=9)
# Method that takes 3 arguments and returns sum of it
def add_numbers(a, b, c):
return a+b+c
# call the method by passing only positional arguments
result = add_numbers(10, 20, 30)
# print the output
print("Addition of numbers is", result)
# Method that takes 3 arguments and returns sum of it
def add_numbers(a, b, c):
return a+b+c
# pass all positional arguments first and then keyword arguments
result = add_numbers(10, 20, c=30)
# print the output
print("Addition of numbers is", result)
# Method that takes 3 arguments and returns sum of it
def add_numbers(a, b, c):
return a+b+c
# call the method by passing only keyword arguments
result = add_numbers(a=10, b=20, c=30)
# print the output
print("Addition of numbers is", result)