💡 What You'll Learn
Parameters let you send data into functions. Inside the parentheses of def, add variable names. When calling the function, provide values called arguments.
params.py
1def greet(name):
2 print("Hello,", name)
3greet("Alex") # name = "Alex"
4greet("Sam") # name = "Sam"
📺 Try with different names!
Your greeting appears here!
🎯 Your Challenges
1Add Numbers
Create a function that adds two numbers
2Multiple Params
Use two parameters: first and last name
3Default Value
Set a default parameter value
📚 What You Learned
- Parameters go inside
()in the def statement - Arguments are values you pass when calling
- Parameters work like variables inside the function
- You can have multiple parameters separated by commas