Exercise: Create function to get last element of list
Define a function named get_last that takes a list as input and returns the last element of that list. Ensure the
print
statements produce the expected outputs.numbers = [30, 40, 20, 50]
names = ['John', 'Mike', 'Sara', 'Emma']
# define function here...
def get_last
print(get_last(numbers)) # expected: 50
print(get_last(names)) # expected: 'Emma'
Python
Setting up Python environment...
Output