Sort Demographics Example

This example shows handling invalid input.

python3 sort_demographics.py
Please select one of the following choices:
            1. Filter records by state name
            2. Filter records by total population
            3. Sort by state name
            4. Sort by total population
            5. Reset list to all records
            0. Quit


Enter selection: 6
Invalid choice, please enter a number between 0 and 5: -3
Invalid choice, please enter a number between 0 and 5: quit
Invalid choice, please enter a number between 0 and 5: I'm done
Invalid choice, please enter a number between 0 and 5: 2

Enter the minimum population: -2
Error: must be a positive integer; please try again!
Enter the minimum population: 1
Enter the maximum population: 5

No records found

Please select one of the following choices:
            1. Filter records by state name
            2. Filter records by total population
            3. Sort by state name
            4. Sort by total population
            5. Reset list to all records
            0. Quit


Enter selection: 1
State prefix: 2

No records found

Please select one of the following choices:
            1. Filter records by state name
            2. Filter records by total population
            3. Sort by state name
            4. Sort by total population
            5. Reset list to all records
            0. Quit


Enter selection: 3

No records found

Please select one of the following choices:
            1. Filter records by state name
            2. Filter records by total population
            3. Sort by state name
            4. Sort by total population
            5. Reset list to all records
            0. Quit


Enter selection: 4

No records found

Please select one of the following choices:
            1. Filter records by state name
            2. Filter records by total population
            3. Sort by state name
            4. Sort by total population
            5. Reset list to all records
            0. Quit


Enter selection: 0

Goodbye!