Untitled

mail@pastecode.io avatar
unknown
plain_text
8 days ago
627 B
1
Indexable
Never
import matplotlib.pyplot as plt

# Data: Prices of textbooks
data = [135, 45, 13, 60, 33, 93, 75, 42, 46, 34, 118, 92, 77, 29, 73, 85, 
        136, 119, 24, 25, 47, 58, 106, 57, 30, 90, 91, 26, 28, 84, 31, 27, 
        86, 105, 88, 89, 76, 83, 48, 104, 44, 74, 41, 61, 12, 43, 134, 59, 
        32, 87]

# Define bin edges with a width of $15
bins = list(range(0, 151, 15))  # From 0 to 150 with step of 15

# Create the histogram
plt.hist(data, bins=bins, edgecolor='black')

# Add titles and labels
plt.title('Histogram of Textbook Prices')
plt.xlabel('Price Range ($)')
plt.ylabel('Frequency')

# Show the plot
plt.show()

Leave a Comment