💡 What You'll Learn
Functions are reusable blocks of code. Define once, use many times! Use def to create a function, then call it by name whenever you need it.
functions.py
1def greet():
2 print("Hello, friend!")
3greet() # Call the function
4greet() # Call again
📺 Run the function!
Click to call the function!
🎯 Your Challenges
1Say Bye
Create a function that says "Goodbye!"
2Double Function
Create a function that doubles a number
3Multiple Calls
Call the same function with different inputs
📚 What You Learned
def function_name():defines a function- Indentation creates the function body
- Call functions by their name with
() - Functions can be called multiple times