Oct-09-2019, 07:28 AM
Hi,
In this function that I defined, it does not return to the maximum number of three, but return None.
I used * args to see how it worked and I saw what it took for when there are many topics to put and I used max to set the maximum value.
I think the problem is just * args and I wanted to know if there is a way to keep * args without adding arguments.
This exercise took it from the Github repository "46 Simple Python Exercises" and this is the exercise:
Regards,
RavCoder
In this function that I defined, it does not return to the maximum number of three, but return None.
I used * args to see how it worked and I saw what it took for when there are many topics to put and I used max to set the maximum value.
I think the problem is just * args and I wanted to know if there is a way to keep * args without adding arguments.
This exercise took it from the Github repository "46 Simple Python Exercises" and this is the exercise:
Quote:Define a function max_of_three() that takes three numbers as arguments and returns the largest of them.
1 2 3 4 5 6 7 8 9 10 |
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)) |
RavCoder