[Solved] Maximum and minimum of integers in python using none type

[ad_1]

In Python 2.7 , the issue is that if you compare an int with None, None would always be smaller than any int. Example to show this –

>>> -100000000000 < None
False

What you would need to do is to put a condition like –

if small is None:
    small = n1
elif small > n1:
    small = n1

[ad_2]

solved Maximum and minimum of integers in python using none type