# What is wrong with this code?

#1

I am trying to make my own code. I defined a function max_of_three() that takes three numbers as arguments and returns the largest of them. Here is my code:

def max_of_three(1,2,3):
if max_of_three[0] > max_of_three[1] and max_of_three[0] > max_of_three[2]:
print max_of_three[0]
if max_of_three[1] > max_of_three[0] and max_of_three[1] > max_of_three[2]:
print max_of_three[1]
else:
print max_of_three[2]

I keep getting the same error: invalid syntax

#2

Probably a good idea to make sure the code is intact, you just added half a dozen mistakes in it while posting it.

A simpler solution, and more general as well, is to take an arbitrary number of arguments and loop through them to find the largest one.

Here's how to deal with any amount of arguments:

def my_max(*args):
for value in args:
print value

Of course, you should get your current function to work first, converting our ideas to code is what a programmer does, so that's what you should practice doing.