OneBite.Dev - Coding blog in a bite size

call a function with parameter in python

Code snippet on how to call a function with parameter in python

def greeting(name):
    print("Hello " + name + "!")

greeting("John")

This code defines a function called “greeting” that takes one parameter called “name”. The function will look at the value of “name” and print a greeting that includes that value. The last line of the code calls the “greeting” function, passing in the string “John” as the parameter. The result of this code is that it prints the string “Hello John!“.

python