How to know Maximum and Minimum values for ints in Python?


Python's core library has two built-in functions max() and min() respectively to find maximum and minimum number from a sequence of numbers in the form of list or tuple object.

example

>>> max(23,21,45,43)
45
>>> l1=[20,50,40,30]
>>> max(l1)
50
>>> t1=(30,50,20,40)
>>> max(t1)
50
>>> min(l1)
20
>>> min(t1)
20
>>> min(23,21,45,43)
21

Updated on: 21-Feb-2020

50 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements