Create function in python to find the highest of all function arguments, and return the "tag" of the value.
- by gatechgrad
Consider the following:
p1=1;
p2=5;
p3=7;
highest=max(p1,p2,p3).
The max function would return 7. I am looking to create a similar function, which would return "p3". I have created a small function (by simple comparisons) for the above example, shown below. however I am having trouble when the number of arguments go up.
def highest(p1,p2,p3)
if (p1p2) and (p1p3):
return "p1"
if (p2p1) and (p2p3):
return "p2"
if (p3p1) and (p3p1):
return "p3".
Is there a simpler way to do this