# hw05.pdf - hw05_master October 11, 2019 1 Homework 5:...

• 10
• 96% (23) 22 out of 23 people found this document helpful

This preview shows page 1 - 4 out of 10 pages.

[2]:exercise=Table.read_table('exercise.csv')exercise[2]:Day (in January) | yoga | walking | sprinting | volleyball1| 50| 0| 0| 02| 0| 65| 0| 653| 50| 70| 0| 04| 0| 0| 0| 755| 0| 0| 0| 06| 0| 0| 0| 07| 0| 0| 0| 08| 0| 55| 0| 09| 0| 0| 0| 010| 0| 30| 0| 0… (21 rows omitted)Different forms of exercise burn calories at different rates; for example, sprinting is more vigorousthan walking.The tablecalories_per_minutecontains estimates of the calories per minuteburned by each activity.[3]:calories_per_minute=Table.read_table('calories_per_minute.csv')calories_per_minute[3]:Exercise| Calories per minuteyoga| 6walking| 5sprinting| 20volleyball | 4Let’s start by finding the total number of minutes you spent exercising each day.Question 1.Write a function calledcompute_exercise_time. It should take one argument, arow from theexercisetable that contains the day and amounts of time (in minutes) spent onyoga, walking, sprinting, and volleyball. It should return the total time spent exercising.HintYou cantbl.row(n)to get thenth row of a table.row.item("column_name")will allow youto select the element that corresponds tocolumn_namein a particular row.BEGIN QUESTIONname: q1_1manual: false[4]:""" # BEGIN PROMPTdef compute_exercise_time(exercise_row):...""";# END PROMPT# BEGIN SOLUTION NO PROMPTdefcompute_exercise_time(exercise_row):yoga_time=exercise_row.item("yoga")2
walking_time=exercise_row.item("walking")sprinting_time=exercise_row.item("sprinting")volleyball_time=exercise_row.item("volleyball")returnyoga_time+walking_time+sprinting_time+volleyball_time# END SOLUTION

Course Hero member to access this document

Course Hero member to access this document

End of preview. Want to read all 10 pages?