Generate a python program to output the largest element in a list.
Given a list x = [7, 9, 5, 8, 3, 11].
def largest_element(x):
    max_element = x[0]
    for number in x:
        if number > max_element:
            max_element = number
    return max_element