 Result : None - Exercise to find max number of three

Result : None - Exercise to find max number of three
0

Hi,
I tried this exercise from “46 Simple Python Exercise” and I don’t want to use if -else conditions, but max () method. I see that there is a way to pass more arguments that is *args, so I used it.
But when compile my code, the result is None.
I think that there is something wrong with *args.
Can you help me?

def max_of_three(*args):
print(max(args))

if __name__ == "__main__":
x = int(input())
y = int(input())
z = int(input())

print("The largest number is:",max_of_three(x,y,z))

Your max_of_three (which is inaccurately named) does not return a value.

Hi @ArielLeslie,
So how can I go about getting something back? Do I have to change * args?
As for the name of my function, the name they gave is just like that
This is exercise:

Define a function max_of_three() that takes three numbers as arguments and returns the largest of them.

Thanks,
CamCode

In order for a function to return a value, it needs a return statement.
If someone is going to grade or review this, you may get marked down because your functionmax_of_three does not specifically take three numbers, as specified in the requirement. It takes any number of arguments.