How to find Maximum and Minimum Values ?


How to find Maximum and Minimum Values ?
 
This is mostly use to find max and min value . If the data is large so it to difficulties to identify the max and min value . In Python there is function called max and min . Where max is use to find maximum value and min use to find minimum value

Syntax 

max( )min( )

Examples for max and min function :-

1st Way- Find max and min
num1=[163,45,28,85,214,101]
print("Minimum value is:",min(num1))
print("Maximum value is:",max(num1))
# ...........................

2nd way find max and min difference
def max_Min_diff(num):
return max(num) - min(num)
num1=[163,45,28,85,214,101]
print("The difference of max and min is:",max_Min_diff(num1))
# .................................................................

3rd way Max and Min using def


def max_min(num):
return "maximum:->",max(num),"minimum:-> ",min(num)
num1=[163,45,28,85,214,101]
print(max_min(num1))
 
And there are So many way ..............

OUT-PUT

“C:UsersuserPython EXhelloworldvenvScriptspython.exe” “C:/Users/user/Python EX/helloworld/Max_Min.py”
 
Minimum value is: 28
Maximum value is: 214
The difference of max and min is: 186
(‘maximum:->’, 214, ‘minimum:-> ‘, 28)
 
Process finished with exit code 0

How to find Maximum and Minimum Values ?

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories

You have successfully subscribed to myprogrammingschool

There was an error while trying to send your request. Please try again.

My Programming School will use the information you provide on this form to be in touch with you and to provide updates and marketing.