View the step-by-step solution to:

Question

# Suppose you'd like to count how many calories you've burned from exercise. You do

4 kinds of exercise: yoga, walking, sprinting, and volleyball. Every day in January, you record how many minutes of each kind of exercise you did that day. Those data are in a table called exercise.csv

How do I sum the 4 different sports, as a sum of the row would also include the 'Day (in January) column?

In [3]: exercise = Table.read_table( 'exercise.csv') exercise Out[ 3 ] : Day (in January) yoga walking sprinting volleyball
1 50 0 0 0 2 0 65 0 65 3 50 70 0 0 4 0 0 0 75 5 0 0 0 0 6 0 0 0 0 7 0 0 0 0 B 0 55 0 0 9 0 0 0 0 10 0 30 0 0 (21 rows omitted) Different forms of exercise burn calories at different rates; for example, sprinting is more vigorous than walking. The table calories _per_minute contai
estimates of the calories per minute burned by each activity. In [4]: calories_per_minute = Table.read_table( 'calories_per_minute.csv')
calories_per_minute 011114] ‘ Exercise Calories per minute
yoga 6 walking 5 sprinting 20 volleyball 4

Let's start by finding the total number of minutes you spent exercising each day. Question 1. Write a function called compute_exercise_time . It should take one argument, a row from the exercise table that contains the day and
amounts of time (in minutes) spent on yoga, walking, sprinting, and volleyball. It should return the total time spent exercising. Hint You can tbl . row( n) to get the n th row of a table. row. item &quot;co lumn_name&quot; ) will allow you to select the element that corresponds to column_name in a particular row. In [10] : def compute_exercise_time(exercise_row) : compute_exercise_time (exercise . row( 0 ) )

### Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

### -

Educational Resources
• ### -

Study Documents

Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

Browse Documents