max function
Question
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
It will take less than 1 minute to register for lifetime. Bonus Tip - We don't send OTP to your email id Make Sure to use your own email id for free books and giveaways
Answers ( 6 )
def max3(a,b,c):
if (a >= b) and (a >= c):
largest = a
elif (b >= a) and (b >= c):
largest = b
else:
largest = c
print(largest)
#Where x can be a list of any numbers (for instance 3 in this case)
def maxi(x):
return np.max(x)
maxi(x)
Will return the maximum number from the list
def maxi(a,b,c):
max=0
if a>b:
max=a
else:
max=b
if max>c:
return max
else:
return c
#Python 3.6
#let’s say we have my_numbers=[a,b,c]
#here a,b,c are the three numbers and we have to find the largest of all
my_number= sorted(my_number)
print(my_number[2])
def max_(a,b,c):
return list(filter(lambda i: i==max(a,b,c), (a,b,c)))
def max_of_3(x,y,z):
if x>=y and x>=z:
largest = x
elif y>= x and y>=z:
largest = y
else:
largest = z
print(largest)