Write a function in Python Web scripting to update the value of a given list.
my_list = [1,2,3]
new_value = 5
def update_list(my_list, new_value):
    my_list[-1] = new_value
    return my_list

my_list = [1,2,3]
new_value = 5

updated_list = update_list(my_list, new_value)
print(updated_list)