<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>
import random
print("\tWelcome to 'Guess My Number'!")<BR>print("I'm thinking of a number between 1 and 100.")<BR>print("Try to guess it in as few attempts as possible.\n")<BR>
# set the initial values<BR>the_number = random.randint(1, 100)<BR>guess = int(input("Take a guess: "))<BR>tries = 1<BR>
# guessing loop<BR>while guess != the_number:<BR> if guess > the_number:<BR> print("Lower...")<BR> else:<BR> print("Higher...")<BR> <BR> guess = int(input("Take a guess: "))<BR> tries = tries + 1<BR>
print("You guessed it! The number was", the_number)<BR>print("And it only took you", tries, "tries!\n")<BR> <BR>input("\n\nPress the enter key to exit.")<BR><BR>*******************************************************************<BR>can anyone explain the <STRONG><U>tries</U></STRONG> part of this programme to me i know its meant to count the number of guesses made by the user by adding 1 but i just cant figure out how it does this..........can someone explain?? i.e. tries = 1, tries +1 etc.... cant get my head around it...<BR>
<BR>
thanks all<BR> <BR><FONT size=3><FONT color=#000000><FONT face="Times New Roman"> </FONT></FONT></FONT><FONT size=3><FONT color=#000000><FONT face="Times New Roman"> </FONT></FONT></FONT><BR>Adrian Kelly <BR>1 Bramble Close<BR>Baylough<BR>Athlone<BR>County Westmeath<BR><BR>0879495663<BR><BR>                                            </div></body>
</html>