Write a function named add_value that has a single parameter. This parameter will be a list/array. Your function needs to add the value 21 to the parameter after its last entry. Because lists and arrays are mutable, your function does not have to return a value.
def add_value(array):
array.append(21)
A = [4, 5, 6, 5, 3, 2, 8, 0, 4, 6, 7, 8, 4, 5, 8]
print(A)
add_value(A)
print()
print("Add the value 21:")
print(A)
Comments
Leave a comment