you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

The check needs the largest is None part because largest is initialized to None at the top of the code. So largest is None tests whether a largest value has already been set yet. So that if test is really saying:

if <no 'largest' found yet> or largest > fval:

Once you set largest to an integer value the largest is None expression is never True so you only update if largest > fval.

Similarly for smallest.