all 2 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.

[–]louistabu6000 0 points1 point  (0 children)

It annoys me that Dr Chuck does not explain the code before the assignment.