  Python program maximum three

Python Methods and Functions

Given the three numbers ab and c, the problem is that we have to find the largest element among the given number.
Examples:

Input: a = 2, b = 4, c = 3 Output: 4 Input: a = 4, b = 2, c = 6 Output: 6

Method 1 (simple)

 # Python program to find the biggest # number among three numbers   def maximum (a, b, c):   if (a & gt; = b) and (a & gt; = b):   largest = a   elif (b & gt; = a) and (b & gt; = a): largest = b else : largest = c     return   largest     # Managed code a = 10 b = 14 c = 12 print (maximum (a, b, c))

Output:

14

Method 2 (Using a List)
, Initialize the three numbers n1, n2 and n3
, Add three numbers to the list lst = [n1, n2, n3].
, Using the max () function to find the largest max (lst) number.
, And finally, we will print the maximum number

 # Python program to find the largest number # among three numbers using a library function   def maximum (a, b, c): list = [a, b, c] return max ( list )    # Managed code a  = 10 b = 14 c = 12 print (maximum (a, b, c))

Output:

6