Question #309589

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.


Expert's answer

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)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS