On 14/12/11 22:41, rog capp wrote:
# Guessing loop while guess != the_number:if guess> the_number: else: guess = int(input("Take a guess: ")) tries += 1 If he/she fails to guess the number after a certain number of attempts then it displays a message about his failure.It needs to be a while
> loop cause it the topic I'm at.
Can anyone give me some help on where to put the loop.
You already have one. Look at the code above, see the while? You do not need another one. And you are already counting how many times round the loop you go. So all you need to do is use that counter to stop the while loop when it reaches a given value. Currently the loop stops when guess == the_number You would like it to also stop when your counter reaches the limit. Do you know how to do that? Have a go and tell us how you get on. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
