Pass a keyword argument to a function.

The first keyword arguments we saw were the sep and end arguments of the print function. A keyword argument always has a default value, so a keyword argument is always optional.

#Print both words on the same line.

print("cup", end = "")
print("cake")
cupcake
We can call the following printLocation function with two or three arguments.

keywordargument.py

40 -74 0
40 -74 1000
40 -74 1000

40 -74 0
40 -74 0

Things to try

  1. Will it let you call the function like this?
    printLocation(altitude = 1000, 40, -75)
    

    I guess not:

    positional argument follows keyword argument