hello,
I have to write a program that draws a chart from dictionary entries. I am able to make a draw a chart however it is unsorted. How can i get it sorted. Please help asap. THANKS in advance.
from random import shuffle
from graphics import *
def main(n):
win = GraphWin("Major Statistics",800,400)
win.setBackground('white')
# Let's define lower left and upper right for the coord.system
x_min = -1.0 # make sure (0,0) is on the screen
y_min = -1.0 # make sure (0,0) is on the screen
x_max = n + 1.0 # give a little extra horizontal space
y_max = n * 2.5 # give 10% extra vertical space
win.setCoords(x_min, y_min, x_max, y_max)
Stats = { "ECSE":45, "LCSI":37, "ECOM":20, "ABIT":6, "ACSM":12, "AEXH":2, \
"AEXP":9, "BULS":8, "APME":7, "BBMB":1, "EBCL":5, \
"EEEL":27, "LDES":4, "LMAT":31, "LPHY":22, "LPSC":41, "LUHU":15, \
"LUPS":11, "LUSS":10 }
L = Stats
for key, value in enumerate(Stats):
x = key
y = L[value]
t = Text(Point(x,y+1), value)
t.draw(win)
line = Line(Point(x,0), Point(x,y))
line.setFill("blue")
line.draw(win)
# wait for final mouse click!
win.getMouse()
win.close()
print "Done"
main(19)