In [9]:
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
 
terms =["F03", "F04", "F05","F06", "F07", "F08", "F09", "F10", "F11", "F12", "F13","F14","F15","F16","F17","F18","F19","F20","F21","F22"]
total = [824, 642, 515, 472, 444, 482, 548, 605, 673, 833, 1033,1237,1383,1581,1733,1972,2170,2354,2663,3287]
 
xaxis = range(len(terms))
 
plt.figure(figsize=(12,8)) 
plt.xlabel("Term")
plt.ylabel("Total Enrollment Computer Science")
plt.xticks(xaxis, terms)
plt.bar(xaxis, total, width=0.5, color='blue')
for a,b in zip(xaxis, total):
    plt.text(a, b+40, str(b), horizontalalignment='center', verticalalignment='center')
blue_patch = mpatches.Patch(color='blue', label='CS Enrollments')
plt.legend(handles=[blue_patch], loc='upper left')
 
plt.savefig('enroll.jpg', dpi=300, bbox_inches='tight')
 
plt.show()
In [7]:
xs = [10,20,30,40]
ys = ['John','Andy','Don','James']
for a,b in zip(xs,ys):
    print(a,b)
10 John
20 Andy
30 Don
40 James

Dictionary¶

In [10]:
d = { 'John': ['123-1111','111-2345'], 'Sally': ['123-2222']}
In [11]:
d['John']
Out[11]:
['123-1111', '111-2345']
In [12]:
d['Sally']
Out[12]:
['123-2222']
In [ ]: