C usually gives the initial value of min to the maximum value from numeric_limits when solving the algorithm problem. That way, if(min>somval) min = someval
will run correctly.
By the way, Python dynamically determines the type, and this question [Is there no limit on the minimum integer value and maximum value of Python? Looking at it, I don't think it's good to use maxint
I wonder if there is a way to express the value of infinite or maximum limit in Python.
python infinite
To express infinity in Python
test = float("inf")
# 3.5 or higher
import math
test = math.inf
You can write. Then
returns all true. Of course, if x is "nan"
or equally infinite, you can return False.
And only in python 2.x (3 is not applicable)
float('inf') < Ellipsis
returns False
© 2024 OneMinuteCode. All rights reserved.