These exercises provide practical experience with functions. You will learn to create and call functions, handle parameters, return values, and use default arguments. Functions organize code, promote reusability, and improve readability.Exercise 1: Simple Greeting FunctionGoal: Define a function that prints a simple greeting message and then call it.Define the function: Create a function named greet_user. Inside this function, use the print() function to display the message "Hello! To Python functions."Call the function: After defining the function, call greet_user() to execute the code inside it.# Define the function here def greet_user(): print("Hello! To Python functions.") # Call the function here greet_user()Expected Output:Hello! Greetings to Python functions.This first exercise demonstrates the basic structure: using def to define the function and calling it by its name followed by parentheses.Exercise 2: Personalized Greeting FunctionGoal: Create a function that accepts a name as an argument and prints a personalized greeting.Define the function: Create a function named greet_personalized that accepts one parameter, let's call it name.Use the parameter: Inside the function, use an f-string or string concatenation to print a message like "Hello, [name]! It's nice to meet you.", where [name] is replaced by the value passed to the function.Call the function: Call greet_personalized() multiple times, passing different names as arguments (e.g., "Alice", "Bob").# Define the function here def greet_personalized(name): print(f"Hello, {name}! It's nice to meet you.") # Call the function with different arguments greet_personalized("Alice") greet_personalized("Bob") greet_personalized("Charlie")Expected Output:Hello, Alice! It's nice to meet you. Hello, Bob! It's nice to meet you. Hello, Charlie! It's nice to meet you.This exercise shows how parameters allow functions to operate on different data provided during the call.Exercise 3: Area Calculation FunctionGoal: Write a function that calculates the area of a rectangle and returns the result.Define the function: Create a function named calculate_rectangle_area that takes two parameters: width and height.Calculate the area: Inside the function, calculate the area ($area = width \times height$).Return the value: Use the return statement to send the calculated area back to the part of the program that called the function.Call the function and use the result: Call calculate_rectangle_area() with sample dimensions (e.g., width=10, height=5). Store the returned value in a variable named area_result.Print the result: Print the value stored in area_result.# Define the function here def calculate_rectangle_area(width, height): area = width * height return area # Call the function and store the result rect_width = 10 rect_height = 5 area_result = calculate_rectangle_area(rect_width, rect_height) # Print the result print(f"The area of a rectangle with width {rect_width} and height {rect_height} is: {area_result}") # You can also use the returned value directly print(f"Another rectangle (8x3) area is: {calculate_rectangle_area(8, 3)}")Expected Output:The area of a rectangle with width 10 and height 5 is: 50 Another rectangle (8x3) area is: 24This demonstrates how return allows functions to produce results that can be used elsewhere in your code.Exercise 4: Power Function with Default ExponentGoal: Create a function that calculates the power of a number, with a default exponent of 2 (squaring the number).Define the function: Create a function named power that takes two parameters: base and exponent. Provide a default value of 2 for the exponent parameter.Calculate the power: Inside the function, calculate base raised to the power of exponent (you can use the ** operator).Return the result: Return the calculated value.Call the function:Call the power function providing only the base argument (e.g., power(5)). This should use the default exponent.Call the power function providing both base and exponent arguments (e.g., power(3, 3)).Print the results: Print the results from both function calls.# Define the function with a default argument def power(base, exponent=2): result = base ** exponent return result # Call the function using the default exponent number_squared = power(5) print(f"5 squared (using default exponent) is: {number_squared}") # Call the function providing both arguments number_cubed = power(3, 3) print(f"3 cubed (providing exponent) is: {number_cubed}")Expected Output:5 squared (using default exponent) is: 25 3 cubed (providing exponent) is: 27This exercise illustrates the convenience of default arguments, making functions more flexible.These exercises cover the fundamental aspects of creating and using functions in Python. Try modifying them or creating your own functions based on these patterns. Experimenting is a great way to learn! As your programs grow, functions will become indispensable tools for managing complexity.