help with this game
From: Alex Endl (alexendl_at_hotmail.com)
Date: 07/17/04
- Next message: Jakub Fast: "Re: is there an encyclopedia of software concepts?"
- Previous message: Stephen Ferg: "is there an encyclopedia of software concepts?"
- Next in thread: Dag Hansteen: "Re: help with this game"
- Reply: Dag Hansteen: "Re: help with this game"
- Reply: Sean Ross: "Re: help with this game"
- Reply: Nick Smallbone: "Re: help with this game"
- Reply: Greg Krohn: "Re: help with this game"
- Reply: Alex Endl: "Re: help with this game"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 17 Jul 2004 11:08:03 -0500
ok now that i know the random function, i made this guessing game. I get an
error though, and Im new so im not to good at figuring out what its talking
about.
import random
a = random.randint(1, 100)
b=-100
c=0
print "Welcome to guess the number"
print "to play type in a number between 1 and 100."
print "but you only get ten tries"
while a != b:
c = c + 1
b = input ("enter guess:")
if b < a :
print "to low"
if c == 10:
print "to many guesses"
print "trie number", c ("out of 10")
elif b > a :
print ("to high")
if c == 10:
print "to many guesses"
print "trie number", c ("out of 10")
print "you got it in ",c," tries"
thanks for your time
- Next message: Jakub Fast: "Re: is there an encyclopedia of software concepts?"
- Previous message: Stephen Ferg: "is there an encyclopedia of software concepts?"
- Next in thread: Dag Hansteen: "Re: help with this game"
- Reply: Dag Hansteen: "Re: help with this game"
- Reply: Sean Ross: "Re: help with this game"
- Reply: Nick Smallbone: "Re: help with this game"
- Reply: Greg Krohn: "Re: help with this game"
- Reply: Alex Endl: "Re: help with this game"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|