# Step 1: Create a function that adds an element to the list
def add_element(list, element):
# Step 2: Add the element to the list
list.append(element)
# Step 3: Return the updated list
return list
# Step 4: Create a function that removes an element from the list
def remove_element(list, element):
# Step 5: Remove the element from the list
list.remove(element)
# Step 6: Return the updated list
return list
# Step 7: Create a function that checks if an element exists in the list
def check_element(list, element):
# Step 8: Check if the element exists in the list
if element in list:
return True
else:
return False
# Step 9: Create a function that returns the maximum value in the list
def find_max(list):
# Step 10: Initialize a variable to store the maximum value
max_value = list[0]
# Step 11: Loop through the list and update the maximum value if a larger value is found
for element in list:
if element > max_value:
max_value = element
# Step 12: Return the maximum value
return max_value
# Step 13: Create a function that returns the minimum value in the list
def find_min(list):
# Step 14: Initialize a variable to store the minimum value
min_value = list[0]
# Step 15: Loop through the list and update the minimum value if a smaller value is found
for element in list:
if element < min_value:
min_value = element
# Step 16: Return the minimum value
return min_value
# Step 17: Display the list
def display_list(list):
print(list)
# Step 18: Create a list of numbers
numbers = [1, 2, 3, 4, 5]
# Step 19: Add an element to the list
add_element(numbers, 6)
# Step 20: Remove an element from the list
remove_element(numbers, 3)
# Step 21: Check if an element exists in the list
print(check_element(numbers, 3)) # True
print(check_element(numbers, 6)) # False
# Step 22: Find the maximum value in the list
print(find_max(numbers)) # 5
# Step 23: Find the minimum value in the list
print(find_min(numbers)) # 1