""" running_log.py: A running logger for runners DS2501: Lab for Intermediate Programming with Data """ class RunningLog: def __init__(self): """ The running log constructor. How you store each run is...

1 answer below »
I attached the assignment below with both necessary files. I am looking to do the extra credit or "to get a 5 on the assignment" as well as stated in the assignment document.


""" running_log.py: A running logger for runners DS2501: Lab for Intermediate Programming with Data """ class RunningLog: def __init__(self): """ The running log constructor. How you store each run is up to you! """ pass def add_run(self, hms, dist_km): """ Record a run. The time is given as 'hh:mm:ss' and the distance is in kilometers """ pass def num_runs(self): """ How many run records are in the database? """ return 0 def plot(self): """ Generate a line plot showing the average pace (minutes per kilometer) for run1, run2, .... run N. The x-axis is the run number, and the y-axis is the average pace for that run. """ pass def save(self, filename): """ OPTIONAL FOR A FIVE: Save the data to a file. """ pass def load(self, filename): """ OPTIONAL FOR A FIVE: Load the data from a file """ pass def main(): # Instantiate a new running log logger = RunningLog() # This is optional logger.load("running.log") # Here are 4 sample running events logger.add_run("35:22:14", 5.1) logger.add_run("37:17:59", 5.5) logger.add_run("32:00:01", 4.9) logger.add_run("30:00:00", 5.0) # Add at least 6 more... # Output some data print(f"There are {logger.num_runs()} runs in the database") logger.plot() # This is also optional logger.save("running.log") if __name__ == '__main__': main() Microsoft Word - ds2500_lab07_runlog.docx DS 2501: Intermediate Programming with Data / Lab Practicum Prof. Rachlin Northeastern University A logging tool for runners A certain professor runs five kilometers a day and would like to better track his progress. In this lab you will create a class called RunningLog that can be used to track each run and plot the runner’s performance over time. Each time we record a run, we store the running time and the total distance. From this we can produce plots showing the average pace (minutes per kilometer) for every recorded run. The RunningLog class has been started for you. Your task is to: 1. Implement all the defined methods 2. Test your RunningLog class on 10 manually logged runs events 3. For extra credit, support loading data from a file and saving data to a file Submit your code (running_log.py) and a visualization showing the runner’s average pace for every recorded run.
Answered 1 days AfterOct 20, 2021

Answer To: """ running_log.py: A running logger for runners DS2501: Lab for Intermediate Programming with Data...

Darshan answered on Oct 21 2021
122 Votes
Capture.JPG
pace.log
Pace for run 1 : 416.12
Pace for run 2 : 406.91
Pace for run 3 : 391.84
Pace for run 4 : 360.0
Pace for run 5 : 367
.13
Pace for run 6 : 385.49
Pace for run 7 : 342.6
Pace for run 8 : 331.57
Pace for run 9 : 339.98
Pace for run 10 : 322.11
running.log
"35:22:14", 5.1
"37:17:59", 5.5
"32:00:01", 4.9
"30:00:00", 5.0
"29:22:14", 4.8
"32:45:59", 5.1
"28:33:01", 5.0
"28:11:00", 5.1
"27:45:53", 4.9
"27:22:45", 5.1
running_log.py
"""
running_log.py: A running logger for runners
DS2501: Lab for Intermediate Programming with Data
"""
pace = []
runlist = []
class RunningLog:
def __init__(self):
#""" The running log constructor. How you store each run is up to you! """
pass
def add_run(self, hms, dist_km):
     #""" Record a run. The time is given as 'hh:mm:ss' and the distance is in kilometers """
if hms.count(':') == 2:
hours, minutes, seconds = hms.split(':')
else:
hours = 0
minutes, seconds = hms.split(':')
        
seconds_total = (int(hours) * 3600) + (int(minutes) * 60) + int(seconds)
seconds_per_km = float(seconds_total) / float(dist_km)
minutes_per_km = float(seconds_per_km / 60)
seconds_rem = int(seconds_per_km - (minutes_per_km * 60))
format_float = "{:.2f}".format(minutes_per_km)
print(format_float)
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here