Functions
Functions are reusable blocks of code that perform a specific task.
Defining Functions
You can define a function using the def
keyword.
def add(a, b):
return a + b
print(add(2, 3))
Function Arguments
Functions can take arguments, which are values you pass to the function.
def greet(name):
return f"Hello, {name}!"
print(greet("Alice"))