positional vs keyword arguments python code example

Example: positional vs keyword arguments python

# POSITIONAL ARGUEMENTS ARE AS THE NAME SAYS THEY ARE POSITIONED
# THE KEYWORD ARGUEMETS ARE DEFINED WITH THEIR KEYS LIKE FOLLOWING

# function that greets from name and their location
# {output}: Hello name, how is it in {location}

def greet(name, location):
  print("Hello", name)
  print("How is it in", location)

# POSITIONAL
greet("John Due", "Nowhere")    # this is called positional arguements 
# because they are defined as their position in the function 
# def greet(name, location) here 1st is name and the 2nd is location 

# KEYWORD
greet(location="Nowhere", name="John Due")    # here you are putting location 
# first but you are using the parameter location to get know the python that 
# this is location (I don't care where the name is but I know that this is location)

#########################################################################
# output
Hello, John Due
How is it in Nowhere?