Re: Need help improving number guessing game

2008-12-16 Thread feba
The good news is that Python functions are objects too, so you can pass them as params to another function. duh, duh, duh, duh, duh! I knew I was missing something there. Thanks. if not mini = x = maxi: also thanks for this, I forgot about that. But I have it as if not minr guess maxr:

Re: Free place to host python files?

2008-12-16 Thread feba
Stuff like code.google, sf.net, are more oriented towards serious development, not just holding random apps, aren't they? Anyway, I found MediaFire, which looks like it will suffice for now. -- http://mail.python.org/mailman/listinfo/python-list

Re: Free place to host python files?

2008-12-16 Thread feba
On Dec 16, 8:29 am, s...@pobox.com wrote:     feba I'm getting started in python, and it would be helpful to have a     feba place to put up various code snippets I've made, so I don't have     feba to send them individually to each person I want to show it to.     feba I'd prefer to use

Free place to host python files?

2008-12-16 Thread feba
I'm getting started in python, and it would be helpful to have a place to put up various code snippets I've made, so I don't have to send them individually to each person I want to show it to. I'd prefer to use something that would give me a directory for my use only, instead of something where

Re: Need help improving number guessing game

2008-12-15 Thread feba
Seems ok. You may want to use arguments with default values for a and b (and possibly to use more meaningfull names): I changed it to minr and maxr. Mini is fine, but I can't name a variable maxi unless I have a good feminine hygiene joke to use with it. I don't see the aim of your changes to

Re: Need help improving number guessing game

2008-12-15 Thread feba
Alright! This is feeling more like it. #!/usr/bin/python #Py3k, UTF-8 import random def setup(game, minr=1, maxr=99): #minr, maxr make minimum and maximum. Can be adjusted. game['minr'], game['maxr'] = minr, maxr game['gcount'] = 0 #Reset guess count game['target'] =

Re: Need help improving number guessing game

2008-12-15 Thread feba
I added the ability to select your own range. It takes two new modules: def customrange(game, lowunsafe=True): game['defrang'] = False #Keeps setup from changing range to defaults while lowunsafe: #makes sure that the low number is positive picklow = int(input(PLEASE PICK THE LOW

Re: Need help improving number guessing game

2008-12-15 Thread feba
Spent a bit more time looking over suggestions and working out some annoyances. import random def customrange(game, lowunsafe=True): game['defrang'] = False #Keeps setup from changing range to defaults while lowunsafe: #makes sure that the low number is positive picklow =

Re: Need help improving number guessing game

2008-12-15 Thread feba
.strip() returns a copy of the string without leading and ending whitespaces (inlcuding newlines, tabs etc). Ahh. I had removed it because it didn't seem to do anything, but I've readded it. And I understand your dictionary stuff correctly now, I think, and I worked it in. Currently, I have:

Re: Need help improving number guessing game

2008-12-14 Thread feba
#!/usr/bin/python #Py3k, UTF-8 import random def setup(): #global target, guess, a, b #a, b make minimum, maximum. Can be adjusted. a, b = 1, 99 target = random.randint(a, b) return a, b, target def playerswitch(player): #Player Switch #if player's a witch, burn her!

Need help improving number guessing game

2008-12-13 Thread feba
#!/usr/bin/python/ #Py3k, UTF-8 import random print( --- WELCOME TO THE SUPER NUMBER GUESSING GAME --- + (\n * 5)) pnum = int(input(1 OR 2 PLAYER?\nP#: )) target = random.randint(1, 99) #Pick a random number under two digits guess1 = 0 #Zero will never be picked as target... guess2 = 0 #so it

Re: Need help improving number guessing game

2008-12-13 Thread feba
#!/usr/bin/python #Py3k, UTF-8 import random def startup(): print(WELCOME TO THE SUPER NUMBER GUESSING GAME!) global pnum, play, player, p1sc, p2sc pnum = int(input(1 OR 2 PLAYERS?\n )) play = True player = P1 #P1 goes first p1sc = 0 #Number of times... p2sc = 0

Re: (Very Newbie) Problems defining a variable

2008-12-12 Thread feba
On Dec 12, 5:56 am, Bruno Desthuilliers bruno. 42.desthuilli...@websiteburo.invalid wrote: feb...@gmail.com a écrit : #!/usr/bin/python #Py3k, UTF-8 bank = int(input(How much money is in your account?\n)) target = int(input(How much money would you like to earn each year? \n))

Re: (Very Newbie) Problems defining a variable

2008-12-12 Thread feba
Actually, I have gedit set to four spaces per tab. I have no reason why it's showing up that large on copy/paste, but the file itself is fine. Thanks for the advice Chris, Stephen, I can definitely see how those are both far better ways of doing it. I have it as: #!/usr/bin/python #Py3k, UTF-8