Need help improving number guessing game

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Sun Dec 14 11:36:28 EST 2008


feba a écrit :
> #!/usr/bin/python
> #Py3k, UTF-8
> 
> import random
> 
> def startup():
>     print("WELCOME TO THE SUPER NUMBER GUESSING GAME!")
>     global pnum, play, player, p1sc, p2sc

You should now try to rewrite the whole thing to avoid using globals.

>     pnum = int(input("1 OR 2 PLAYERS?\n> "))

What happens here if you type something that's not a valid argument for 
int() ?

(snip)



More information about the Python-list mailing list