On Dec 12, 5:56 am, Bruno Desthuilliers 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>>"))
>
> > interest = 0
> > i =
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
b
#!/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 #
#!/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
#!/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!
>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 s
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'] = random.randin
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
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 = int(inp
> .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:
>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:
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
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
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 you
14 matches
Mail list logo