This Python program compares the top 10 U.S. states with the highest average teacher salaries against their cost of living indices. The goal is to visualize whether higher salaries truly equate to better affordability for teachers. Using four types of charts and three custom calculations, this program helps explore differences in compensation versus expenses.
This program was designed to explore whether high teacher salaries in different U.S. states actually translate into better financial well-being by also considering each state’s cost of living. The goal was to use Python lists and visualizations to analyze and present this data in a meaningful way.
The data used in this program comes from publicly available state salary reports and cost of living indices. Three lists were created:
top_10_sal: Average salary in each state.
top_10_col: Cost of living index.
top_10_state: State names.
When the program is run, it displays four different graphs and prints the minimum, maximum, and average salary from the data. These results help answer whether the highest salaries actually provide better value when factoring in cost of living.
Function Purposes
scatter_visual(x, y)
Creates a scatter plot comparing average teacher salary (y) to cost of living index (x) across the top 10 states.
line_visual(x, y)
Plots a line graph showing the average salary (y) in each state (x). Helps visualize salary trends across states.
bar_visual(x, y)
Displays a bar chart of the cost of living index (y) for each state (x). Useful for comparing living expenses.
pie_visual(state, salary)
Creates a pie chart showing the percentage share of total salary contributed by each state. Great for seeing proportionally which states pay the most.
minimum_val(some_list)
Loops through a list and returns the smallest number. Used to find the lowest salary.
maximum_val(some_list)
Loops through a list and returns the largest number. Used to find the highest salary.
average_val(some_list)
Calculates the average of values in a list by manually summing and dividing by length. Used to find the mean salary.
main()
The main control function that:
Stores the data in lists
Calls all graph functions
Calls the calculation functions and prints the results
Runs the whole program
Visualizing Teacher Salaries vs Cost of Living Script