Creating a function

At FitBit, you’re working on motivational messages to provide to users. Specifically, you’d like to create a function that (1) computes the average number of steps taken across a one-week period, and (2) prints a message to the user about that average.

In the cell below, define the function week() that takes a single input, steps_list. Note that steps_list will be a list of steps taken each day. (Remember, when defining a function, you shouldn’t include any specific values inside your function. Rather, you want your function to work flexibly with any input provided when the function is actually called.)

Your function should include a docstring indicating that the function’s purpose is to print the average number of steps per week. Then do the following:

Compute the average number of steps taken that week
Hint: Review the lecture on lists, including how to sum up the contents of a list, and how to determine the length of a list. How do you calculate an average based on the sum and number of values?
Round the resulting value using the built-in function we’ve discussed
Convert this rounded value to a string when printing the following message: This week, you took an average of x steps!
Instead of x, use the variable representing the rounded average you computed above. Remember that if you want to add a number and a string together, you first need to convert the number to a string.

Sample Solution

ACED ESSAYS