This commit is contained in:
2509165027
2026-07-04 19:26:15 +08:00
parent 74906f0596
commit 4dce57e1c9
4 changed files with 38 additions and 38 deletions

0
q4/q4_1.py Normal file
View File

0
q4/q4_2.py Normal file
View File

15
q4/q4_3.py Normal file
View File

@@ -0,0 +1,15 @@
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(ratings, bins=5,color='blue')
plt.savefig('q4_3a_hist.png')