0
What is the application of -float('inf') in line 2 ?
Would you help me to find out the application of line 2 ? why is written -float('inf') and not float('inf') ? what is the nature of 'inf' ? https://code.sololearn.com/cQdY1aAwCw9x/#py
2 Answers
+ 10
'inf' means infinity. The application of the second line is to initialize the max value as low as possible, so that no other concrete value is smaller than it.
+ 5
In python, infinity is represented as: float('inf')
So, -float('inf') represents the lowest possible number in mathematics i.e., "negative infinity".
Hope it helps!