Parameterized Function

Last Updated: 01th September 2025


A parameterized function is a function that takes input values (parameters/arguments).This makes the function more flexible and reusable because the same function can work with different data.

📝 Syntax:

def function_name(parameter1, parameter2, ...):
    # function body
    #..
    #..
    #
#When Call ir
function_name(argument1, argument2, ...)

Example 1.

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

# Calling function with parameter
greet("Amit")
greet("Suraj")

# Output:
# Hello, Amit!
# Hello, Suraj!

Example 2.

def  add(x, y):
    print(x + y)

# Calling function with parameters
add(3, 4)  # Output: 7
add(10, 5)  # Output: 15
add("Hello", "World")  # Output: "HelloWorld"

Example 3.

def calculate_mean(numbers):
    print(sum(numbers) / len(numbers))

# Calling function
print(calculate_mean([10, 20, 30, 40]))
print(calculate_mean([5, 15, 25]))

💡 Quick Practice