Graduates Sort Example 3

This example shows handling invalid input.

$ python3 sort_graduates.py
Please select one of the following choices:
  (1) Filter records by major
  (2) Filter records by mean salary
  (3) Sort by year
  (4) Sort by mean salary
  (5) Reset list to all records
  (0) Quit
Choice? -22
Invalid choice, try again!
Choice? 2
Minimum mean salary? Hey there
Salary must be 0 or greater.
Minimum mean salary? -7
Salary must be 0 or greater.
Minimum mean salary? 20000
Maximum mean salary? 10000
Maximum must be equal or greater than minimum.
Maximum mean salary? 30000
2 found
BIOL01:Biological Sciences, 2001. Mean salary: $28335.21. Total graduates: 121173. Total employed graduates: 92858
PSYC01:Psychology, 2001. Mean salary: $27500.55. Total graduates: 173766. Total employed graduates: 149937

Please select one of the following choices:
  (1) Filter records by major
  (2) Filter records by mean salary
  (3) Sort by year
  (4) Sort by mean salary
  (5) Reset list to all records
  (0) Quit
Choice? 0
Have a nice day!