Menu
CoddyTech

Recap: Weekly Steps

Part of the Data and Plots section of Coddy's Machine Learning journey. Lesson 25 of 60.

challenge icon

Challenge

Medium

Remember the chart that opened this chapter? Now you build it. Ana and Ben aim for 10 thousand steps a day; ana and ben hold days 1 to 7.

In the ax form, with steps in thousands up (8420 is 8.42), draw in this order:

  1. Ana: a purple solid line with circles.
  2. Ben's days at 10 or more: green dots.
  3. Ben's other days: red dots.
  4. The goal: a black dashed line from (1, 10) to (7, 10).

Yours should look like this one, from last week:

A chart titled Weekly Steps: Ana's purple line with circles, Ben's days as green dots above the goal and red dots below it, a black dashed goal line at 10 and a legend

Use these exact texts: the title Weekly Steps, the labels Day and Steps (thousands), and the legend names Ana, Ben met goal, Ben missed and Goal. Your program prints nothing; Coddy describes your chart.

Try it yourself

import numpy as np
import matplotlib.pyplot as plt

days = np.arange(1, 8)
ana = np.array([8420, 11250, 9800, 12400, 7600, 10900, 13100])
ben = np.array([6200, 7400, 10100, 10000, 9500, 12000, 11300])

# Write your code below

All lessons in Data and Plots

Practice on your own: Online Python compiler