""" Felix Muzny DS 2000 Lecture 5 September 20, 2024 A program to visualize the top 3 salaries in MA 2023 (from a file!) """ import matplotlib.pyplot as plt FILENAME = "ma_salarytop3.txt" def main(): print("lec 5 - ma salaries no loop") # step 1 - gather data with open(FILENAME, "r") as salary_file: # readline always returns a string! salary1 = int(salary_file.readline()) salary2 = int(salary_file.readline()) salary3 = int(salary_file.readline()) # step 2 - any computations? # calculate the max max_salary = max(salary1, salary2, salary3) # calculate the min min_salary = min(salary1, salary2, salary3) # step 3 - communication - give the user information! print("Max salary:", max_salary) print("Min salary:", min_salary) plt.plot(1, salary1, "*", color="red") plt.plot(2, salary2, "*", color="red") plt.plot(3, salary3, "*", color="red") plt.title("top 3 MA salaries 2023") plt.xlabel("rank") plt.ylabel("total salary") plt.show() main()