Call Functions in Python: 2 Easy Methods
In Python, functions can be called in two ways:
- hi
def hello(name):
print("Hello, " + name)
hello("Alice")
- say hello
def greet(name):
print("Nice to meet you, " + name)
my_func = greet
my_func("Bob")
Regardless of the method, it can be used to call a function and execute the code defined within it.