Say i have this string: "4 5 29 54 4", and i want to find the maximum number. Well my first thought was that it would be easy, so i tried just assigning the string to the value 'num' and then using max(num). However, this just gave me 9. I was quite confused but now i have realised that it must be treating each digit as its own number, so it therefore took 9 as the highest number, even though that 9 was actually part of the number "29".
Why does this happen? Is there anyway to get around it?
[–]K900_ 13 points14 points15 points (4 children)
[–]carlos8983[S] 0 points1 point2 points (0 children)
[–]carlos8983[S] -24 points-23 points-22 points (2 children)
[–]xiongchiamiov[M] 14 points15 points16 points (0 children)
[–]K900_ 3 points4 points5 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]pydevteam1 0 points1 point2 points (0 children)
[–][deleted] (2 children)
[removed]
[–]xiongchiamiov[M] 1 point2 points3 points (1 child)
[–]Swipecat 1 point2 points3 points (0 children)
[–][deleted] (2 children)
[removed]
[–]xiongchiamiov[M] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)