The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

This topic is READ ONLY
puzzles (1) [Avatar] Offline
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?


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!"
print "No more guesses! Better luck next time, matey!"
print "The secret number was", secret
warren.sande (211) [Avatar] Offline
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, I'll have a look. (Send the .py file as an attachment.)

Warren Sande