Question: Please Answer in python codeblock You work as a contractor for a dog-walking company, developing some of their backend applications. Their employees (the dogwalkers) use

Please Answer in python codeblock

You work as a contractor for a dog-walking company, developing some of their backend applications. Their employees (the dogwalkers) use a logging system that logs their walks by appending to a list of tuples. Each tuple has the structure (walker_name, dog_name, minutes_walked).

To make this information more readable, you are asked to display a summary table of this information. The columns of the table should represent each dog walker; each row represents each dog; and each entry in the table corresponding to a walker w and a dog d should have the total number of minutes that w has walked d.

Your output should print this information with the walker names and dog names in sorted order. The data should be evenly spaced and easy to read.

Execute the code cell below to initialize the test list of tuples.

logs = [ ("Marceline", "Oakley", 30), ("Kelly", "Luther", 15), ("Ryan", "Appa", 30), ("Forest", "Appa", 20), ("Marceline", "Oakley", 10), ("Marceline", "Appa", 20), ("Kelly", "Luther", 20), ("Kelly", "Luther", 10), ("Forest", "Oakley", 25), ("Marceline", "Luther", 20), ("Ryan", "Oakley", 15), ("Ryan", "Appa", 10), ("Marceline", "Luther", 15) ]

For reference, a possible tabular output for the above data is:

 Forest Kelly Marceline Ryan Appa 20 0 20 40 Luther 0 45 35 0 Oakley 25 0 40 15 

If you happen to already be familiar with objects like data frames from certain data science libraries, be sure NOT to use these. All of your code should utilize data structures in Python's standard library (i.e. lists, dicts, etc.).

You may find it useful to print without a newline at the end. Python's print function allows you to specify what string to add to the end of a print statement, which is by default . If you instead use an empty string, the newline will not be printed.

print("a", end="") # replace ` ` with empty string print("b") print("c")

produces the following output:

ab c

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!