This topic is READ ONLY
puzzles (1) [Avatar] Offline
#1
Followed the install instructions and the first (pizza) exercise.
Had several false starts, got error message that the "socket could not be found"
restarted computer

Then went to the numguess
Did a copy/paste as below and only get one guess

Is it an indent error?

Thanks

====================
import random

secret = random.randint(1, 99)
guess = 0
tries = 0

print "AHOY! I'm the Dread Pirate Roberts, and I have a secret!"
print "It is a number from 1 to 99. I'll give you 6 tries. "

while guess != secret and tries < 6:
guess = input("What's yer guess? ")
if guess < secret:
print "Too low, ye scurvy dog!"
elif guess > secret:
print "Too high, landlubber!"
tries = tries + 1
if guess == secret:
print "Avast! Ye got it! Found my secret, ye did!"
else:
print "No more guesses! Better luck next time, matey!"
print "The secret number was", secret
warren.sande (211) [Avatar] Offline
#2
Re: Install and the number guess
Unfortunately, this forum deletes whitespace, so I can't see if there are indenting errors. If you send the code to cp4khelp@yahoo.com, I'll have a look. (Send the .py file as an attachment.)

Regards,
Warren Sande