For a given list of numbers, generate a python code that finds the largest number in the list.
[7, 5, 2, 9, 1]
def find_max(arr):
    max_number = 0

    for i in arr:
        if i > max_number:
            max_number = i
    return max_number