Given three numbers, write a Python program that prints the largest among them.
def max_of_three(x, y, z):
    max_num = x
    if y > max_num:
        max_num = y
    if z > max_num:
        max_num = z
    return max_num