forked from 2509165022/simulated-examination
14 lines
347 B
Python
14 lines
347 B
Python
import json
|
|
import matplotlib.pyplot as plt
|
|
|
|
movies = json.load(open('movies.json', encoding='utf-8'))['movies']
|
|
# print(movies)
|
|
ratings = []
|
|
durations = []
|
|
for m in movies:
|
|
ratings.append(m['rating'])
|
|
durations.append(m['duration'])
|
|
|
|
plt.figure(figsize=(8,5))
|
|
plt.hist(durations, bins=5,color='blue')
|
|
plt.savefig('q4_3b_hist.png',dpi=150) |