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

10th Mar 2018, 3:13 PM
NIMA
NIMA - avatar
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.
10th Mar 2018, 3:32 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
+ 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!
10th Mar 2018, 3:30 PM
777
777 - avatar