''' DS2000 Fall 2024 Code from class 9/13/24 Dogs' energy levels relative to each other, and how much time we spend at the park Test cases: * dog1 = 10, dog2 = 5, then... dog1 has 2x, 200% dog2's level * 102 minutes at the park is... 1 hour, 42 minutes ''' import matplotlib.pyplot as plt MINS_PER_HOUR = 60 def main(): # Step one: gather data from the user energy_one = int(input("Energy level of first dog (1-10)?\n")) energy_two = int(input("Energy level of second dog (1-10)?\n")) park_one = int(input("Time at park for dog one?\n")) park_two = int(input("Time at park for dog two?\n")) # Step two: computations energy_times = energy_one / energy_two energy_pct = energy_times * 100 park_hours = park_one // MINS_PER_HOUR park_mins = park_one % MINS_PER_HOUR # Step three: communication, report results print("The first dog has", energy_times, "the energy of the second.") print("That is ", energy_pct, "%!", sep = "") print("The first dog spent", park_hours, "hours and", park_mins, "minutes at the park :)") # Step three: communication, make a plot! plt.plot(energy_one, park_one, "o", color = "magenta") plt.plot(energy_two, park_two, "o", color = "limegreen") plt.title("Laney's Dogs: Energy level vs time at park") plt.xlabel("Energy Level (1-10 scale)") plt.ylabel("Time at Park (minutes)") plt.show() main()