Design an algorithm in Python that takes in a list of numbers and prints out the first and last element in the list.
lst=[5,3,1,7,9]
def first_last(lst):
    first_element = lst[0]
    last_element = lst[-1]
    return [first_element, last_element]

print(first_last([5,3,1,7,9]))