Sinisterly
[Python] Guess your number - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Python (https://sinister.ly/Forum-Python)
+--- Thread: [Python] Guess your number (/Thread-Python-Guess-your-number)

Pages: 1 2 3 4


[Python] Guess your number - chmod - 02-09-2013

I wrote this a while ago and forgot all about it if I'm honest, Deque reminded me with her competition here. it's nothing special you think of a number and the program guesses it and prints out how many tries it took

Code:
# Guess your number
# Player thinks of a number between 1 and 100 and the computer tries to guess it

import random

print "Think of a number between 1 and 100."
print "And I will try to guess it."

tries = 0
guess = ""
high = 100
low = 1
while guess != "c":
    number = random.randrange(low, high)
    print "I think of: ", number
    guess = raw_input("[h]iger, [l]ower, [c]orrect: ")
    if guess == "h":
        low = number +1
        tries += 1
    if guess == "l":
        high = number -1
        tries += 1
  
print "I got it in ", tries, "go's!"


raw_input("\n\nPress the enter key to exit.")



[Python] Guess your number - chmod - 02-09-2013

I wrote this a while ago and forgot all about it if I'm honest, Deque reminded me with her competition here. it's nothing special you think of a number and the program guesses it and prints out how many tries it took

Code:
# Guess your number
# Player thinks of a number between 1 and 100 and the computer tries to guess it

import random

print "Think of a number between 1 and 100."
print "And I will try to guess it."

tries = 0
guess = ""
high = 100
low = 1
while guess != "c":
    number = random.randrange(low, high)
    print "I think of: ", number
    guess = raw_input("[h]iger, [l]ower, [c]orrect: ")
    if guess == "h":
        low = number +1
        tries += 1
    if guess == "l":
        high = number -1
        tries += 1
  
print "I got it in ", tries, "go's!"


raw_input("\n\nPress the enter key to exit.")



[Python] Guess your number - chmod - 02-09-2013

I wrote this a while ago and forgot all about it if I'm honest, Deque reminded me with her competition here. it's nothing special you think of a number and the program guesses it and prints out how many tries it took

Code:
# Guess your number
# Player thinks of a number between 1 and 100 and the computer tries to guess it

import random

print "Think of a number between 1 and 100."
print "And I will try to guess it."

tries = 0
guess = ""
high = 100
low = 1
while guess != "c":
    number = random.randrange(low, high)
    print "I think of: ", number
    guess = raw_input("[h]iger, [l]ower, [c]orrect: ")
    if guess == "h":
        low = number +1
        tries += 1
    if guess == "l":
        high = number -1
        tries += 1
  
print "I got it in ", tries, "go's!"


raw_input("\n\nPress the enter key to exit.")



RE: [Python] Guess your number - Deque - 02-09-2013

Haha, nice. I guess you don't want to make it a challenge submission?
Oh, and I am thinking of a number ...


RE: [Python] Guess your number - Deque - 02-09-2013

Haha, nice. I guess you don't want to make it a challenge submission?
Oh, and I am thinking of a number ...


RE: [Python] Guess your number - Deque - 02-09-2013

Haha, nice. I guess you don't want to make it a challenge submission?
Oh, and I am thinking of a number ...


RE: [Python] Guess your number - chmod - 02-09-2013

I could do but you stated you didn't want anything like the guess the number game and with this being so similar I din't think you'd want it


is it 2?


RE: [Python] Guess your number - chmod - 02-09-2013

I could do but you stated you didn't want anything like the guess the number game and with this being so similar I din't think you'd want it


is it 2?


RE: [Python] Guess your number - chmod - 02-09-2013

I could do but you stated you didn't want anything like the guess the number game and with this being so similar I din't think you'd want it


is it 2?


RE: [Python] Guess your number - Deque - 02-09-2013

(02-09-2013, 04:23 PM)chmod Wrote: I could do but you stated you didn't want anything like the guess the number game and with this being so similar I din't think you'd want it


is it 2?

No, I only said you won't get 500 points for it as it is not worth so much. You may get 200 for that. Biggrin

No. Higher.