Functions with Default Parameter Values in Python


Define functions with default values for parameters.

Source Code

def greet(name, greeting="Hello"):
    print(f"{greeting}, {name}!")

greet("Alice")
greet("Bob", "Howdy")
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments