A visitors-by-time-slot chart that opens without the internet

Write code · Medium · §9.5 Saving and sharing as HTML

The table slots holds the number of zoo visitors in each time slot. Draw a bar chart with the time slot (slot) on the x-axis and the visitors (visitors) on the y-axis, with the title Zoo visitors by time slot.

The chart will be opened on a ticket-office computer without the internet. Make a folder share and save the chart in it as one file, zoo_slots.html, with Plotly.js inside the file so that the chart draws even when only this file is moved. Grading changes the visitor counts and draws the chart again.

Target figure for A visitors-by-time-slot chart that opens without the internet
Target figure

Starter code

from pathlib import Path

import pandas as pd
import plotly.express as px

slots = pd.DataFrame({
    "slot": ["09-11", "11-13", "13-15", "15-17"],
    "visitors": [85, 140, 120, 60],
})

# Write your code here

Solve this problem in your browser

Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.