can someone explain why this happens- newbie question

garywood woodygar at sky.com
Tue Sep 30 11:21:08 CEST 2008


Hi 
can someone tell me why it prints the high score table multiple times?

#high scores program
scores =[]
choice = None

while choice != 0:
    print """high Score Table
        0 - exit
        1 - show Scores
        2 - add a score
        3 - delete a score
        4 - sort scores
        """
    choice = input("what would you like to do?")
    if choice == 0:
        print "goodbye"
    elif choice == 1:
        for score in scores:
            print scores
    elif choice == 2:
        score = input("add a score")
        scores.append(score)
    elif choice == 3:
        score = input("what score would you like to delete ?")
        if score in scores:
            scores.remove(score)
        else:
            print "that score is not listed"

            
    elif choice == 4:
        scores.sort()
        scores.reverse()
        print scores, "highest score first"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080930/1a52d8db/attachment.html>


More information about the Python-list mailing list