python max and min function in Hindi | Max & Min Function in Python

python max and min function in Hindi | Max & Min Function in Python

Python max and min :- Max And Min in Python me aap in dono ka istemal karke Max Value Or Min Value Find Kar Sakte hai |

Pyhton Max & Min Function in Hindi ko samanjh ne ke liye ham examples ko dekhte hai.

Python Max and Min function in Hindi

Syntax

max()
min()
max() and min() Funciton in python

Python Max() & Min()Function

Python Max() Function ka istemal karke ham Maximum Value ko find karte hai|

Python Min() Function ka istemal karke ham Manimum Value ko find karte hai |

In Dono ke ham Kuch Examples ko dekhte hai |

Example:

a = [1,245,34,32]
print("The Maximum Value Is : ",max(a))
print("The Manimum Value Is : ",min(a))

Output :

The Maximum Value Is :  245
The Manimum Value Is :  1

Aap Uper Diye Gye Output ko samanjh sakte hai |

Example 2:

# find string Max and Min Only First Latter capital 

names = ['Danish','ali','Masterprograming.com']
print("The Maximum Value Is : ",max(names))
print("The Manimum Value Is : ",min(names))

Output:

The Maximum Value Is :  Masterprograming.com
The Manimum Value Is :  Danish

Upper Diye Gaye output ko samanjh sakte hai or minimum value me Danish aaya hai joki usne ASNI value ko find karke pta lgaya hai Example 3 me item value se pta karna sikhte hai |

Advance Python Max & Min Function

Ham Ab Max() & Min Function ko Advance Level pe istemal karte hai |

Example 3:

find string Max and Min Function using item


def func(item):
	return len(item)


names = ['Danish','MasterPrograming','ali' ,'Pandey']
Max_value = max(names , key=func)
Min_value = min(names , key=func)
print("The Maximum Value Is : ",Max_value)
print("The Manimum Value Is : ",Min_value)

Output:

The Maximum Value Is :  MasterPrograming
The Manimum Value Is :  ali

Example 4 :

Ham Is Program me list ke under dictionary create karke usme se highest score find karke fir uska keval Name print karate hai | Lekin Aap Score & Name ki jagah kuch or bhi print kara sakte hai |

data = [
       {'Name':'Danish','Score':105,'Age':14},
       {'Name':'Rahul','Score':150,'Age':19},
       {'Name':'Faizan','Score':200,'Age':25},
       {'Name':'Sunil','Score':15,'Age':44}
       ]

print(max(data , key = lambda item:item.get('Score'))['Name'])
print(min(data , key = lambda item:item.get('Score'))['Name'])

Agar Aap Name ki jagah kuch or bhi print kara sakte hai |

Output:

Faizan
Sunil

Example 5:

Ham Is Program me dictionary create karke usme se Highest score find karke fir uska keval Name print karate hai |

data = {
       'Danish':{'Score':105},
       'Rahul' : {'Score':150},
       'Faizan': {'Score':200},
       'Sunil' : {'Score':15}
       }       
       

print(max(data , key = lambda item:data[item]['Score']))
print(min(data , key = lambda item:data[item]['Score']))

Agar Aap Name ki jagah kuch or bhi print kara sakte hai ye ham example example 5 me dekhte hai |

Output:

Faizan
Sunil

Example 6 :

Find Max and min value using lambda function and max & min function

names = ['Danish','MasterPrograming','ali' ,'Pandey']
Max_value = max(names , key = lambda item: len(item))
Min_value = min(names , key = lambda item: len(item))
print("The Maximum Value Is : ",Max_value)
print("The Manimum Value Is : ",Min_value)

Output :

The Maximum Value Is :  MasterPrograming
The Manimum Value Is :  ali

Python Related Post

python max and min function in Hindi

Dosto mujhe ummed hai ki aap python max and min function  ko acchi tarah se samanj gye honge agar aap ko ye post acchi lage to mere is website ko jarur follow kre or ha agar aap video bhi dekhna chahte hai to aap mere channel ko bhi subscribe kar sakte hai. channel ka link aapko home page par mil jayega |

Danish Ali

I Am a 1st Sem BCA Student & I have Skills C, C++ ,Python, HTML,CSS, Computer & Advance Hacking & Blogger & YouTuber.

Leave a Reply

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