can someone explain why this happens- newbie question

Almar Klein almar.klein at gmail.com
Tue Sep 30 11:38:22 CEST 2008


change:
for score in scores:
    print scores
to:
for score in scores:
    print score
that should do the trick :)

Almar

2008/9/30 garywood <woodygar at sky.com>

>  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"
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080930/a6893ebb/attachment.html>


More information about the Python-list mailing list