Open this example in the interactive library
Source code
def greet(name, *, punctuation='!'):
return f'Hello {name}{punctuation}'
print(greet('Ada', punctuation='.'))Sample output
Hello Ada.

Use keyword-only parameters. A self-contained example using the Python standard library.
Open this example in the interactive library
def greet(name, *, punctuation='!'):
return f'Hello {name}{punctuation}'
print(greet('Ada', punctuation='.'))Hello Ada.