Bhai koi btao answer 5 kaise aaye??? How instead of 5.0 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Bhai koi btao answer 5 kaise aaye??? How instead of 5.0

m = [2,5,2.5,3,5.0] x = max(m) print(x)

2nd Jan 2021, 12:42 PM
Sagar Kumar
Sagar Kumar - avatar
2 Answers
+ 3
Sagar Kumar Bro I was a little off in my first explanation. Here is a new one. They're the same but I think it is because the index of 5 is less than 5.0. which means iteration of 5 comes first before 5.0. Try this for example: m = [2, 5.0, 5, 2.5, 3] x = max(m) print(x) >> 5.0 because 5.0 comes first before 5 This is what happens in the background when using max. https://code.sololearn.com/ca1482a3A17a
2nd Jan 2021, 12:57 PM
noteve
noteve - avatar
+ 2
Thanks brother
2nd Jan 2021, 12:53 PM
Sagar Kumar
Sagar Kumar - avatar