[Tutor] bug in exam score conversion program

Alan Gauld alan.gauld at btinternet.com
Sun Oct 5 01:55:50 CEST 2008


"Kent Johnson" <kent37 at tds.net> wrote

>> It's not too bad but I would probably use a dictionary rather
>> than the list - which avoids the index problem
> 
> Not sure how the dict is better - in either case, leaving off the
> grade corresponding to a score of 100 will raise an exception.

Sure, you could just extend the list to have 11 elements 
but its less obvious than with the dictionary which for this purpose 
provides a self documenting mapping between the score and 
the grade. IMHO of course :-)

Alan G.





More information about the Tutor mailing list