Google News
logo
Python Program to Create and call a Function
In the following example of Python program that creates and calls a function :
Program :
def greet(name):
    print("Hello, " + name + "!")

greet("Alice")
greet("Bob")
greet("Charlie")
Output :
Hello, Alice!
Hello, Bob!
Hello, Charlie!
In the above example, the `greet()` function takes one parameter, `name`, and prints a greeting message that includes the value of that parameter.

The function is called three times, with different values passed as the `name` argument.