Introduction
Multiple parameters let you send more than one piece of information to a function at the same time.
Jump into concepts and practice - no test required
Multiple parameters let you send more than one piece of information to a function at the same time.
def function_name(param1, param2, param3): # code using param1, param2, param3
Parameters are separated by commas inside the parentheses.
You can use as many parameters as you need, but keep it simple.
def greet(name, age): print(f"Hello {name}, you are {age} years old.")
def add(x, y): return x + y
def describe_pet(pet_name, animal_type): print(f"I have a {animal_type} named {pet_name}.")
This program defines a function that multiplies two numbers and prints the result.
def multiply(a, b): return a * b result = multiply(4, 5) print(f"4 times 5 is {result}")
Always give parameters clear names so your code is easy to understand.
Parameters are like placeholders; when you call the function, you give them actual values called arguments.
Functions can have multiple parameters separated by commas.
Parameters let functions work with different pieces of information.
Use clear names to make your code easy to read and maintain.
def greet(name, age):x and y?def multiply(a, b):
return a * b
result = multiply(3, 4)
print(result)def greet(name, age)
print(f"Hello {name}, you are {age} years old.")describe_person that takes name, age, and city as parameters and returns a sentence like:"Alice is 30 years old and lives in Paris."