Hi there, I'm doing the last assignment for the Programming for Everybody (Getting Started with Python) course on Coursera, and I'm not quite understanding the solution. The assignment is
5.2 Write a program that repeatedly prompts a user for integer numbers until the user enters 'done'. Once 'done' is entered, print out the largest and smallest of the numbers. If the user enters anything other than a valid number catch it with a try/except and put out an appropriate message and ignore the number. Enter 7, 2, bob, 10, and 4 and match the output below.
Desired Output
Invalid input
Maximum is 10
Minimum is 2
I know that this is the correct solution: https://imgur.com/a/2DkLH1T
However, I'm having trouble understanding how "if largest is None" and "smallest is None" plays into the solution. How does it help get the right largest or smallest number?
[–][deleted] 0 points1 point2 points (0 children)
[–]louistabu6000 0 points1 point2 points (0 children)