<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Mar 2, 2014, at 6:40 PM, Scott W Dunning <<a href="mailto:swdunning@cox.net">swdunning@cox.net</a>> wrote:</div></div><br><div>This is what Im having trouble with now.  Here are the directions I’m stuck on and what I have so far, I’ll bold the part that’s dealing with the instructions if anyone could help me figure out where I’m going wrong.  </div><div><br></div><div>Thanks!</div><div><br></div><div><div style="font-family: CMR10; font-size: 10pt;"><span style="font-size: small;">from random import randrange</span></div><div><div><font face="CMR10" size="2">randrange(1, 101)</font></div><div><span style="font-family: CMR10; font-size: small;">from random import seed</span></div><div><span style="font-family: CMR10; font-size: small;">seed(129)</span></div><div><font face="CMR10" size="2">    </font></div><div><span style="font-family: CMR10; font-size: small;">def print_description():</span></div><div><font face="CMR10" size="2">    print """Welcome to Guess the Number.</font></div><div><font face="CMR10" size="2">    I have seleted a secret number in the range 1 ... 100.</font></div><div><font face="CMR10" size="2">    You must guess the number within 10 tries.</font></div><div><font face="CMR10" size="2">    I will tell you if you ar high or low, and</font></div><div><font face="CMR10" size="2">    I will tell you if you are hot or cold.\n"""</font></div><div><font face="CMR10" size="2">   </font></div><div><span style="font-family: CMR10; font-size: small;">def get_guess(guess_number):</span></div><div><font face="CMR10" size="2">    promt = "(" + str(guess_number) +") Please enter a guess:"</font></div><div><font face="CMR10" size="2">    user_guess = raw_input(promt)</font></div><div><font face="CMR10" size="2">    user_guess = int(user_guess)</font></div><div><font face="CMR10" size="2">    return user_guess</font></div><div><font face="CMR10" size="2"><br></font></div><div><span style="font-size: small;"><b>def print_hints(secrets, guess):</b></span></div><div><font size="2"><b>    secret_number = secret</b></font></div><div><font size="2"><b>    guess = guess</b></font></div><div><font size="2"><b>    if guess < 0 or user_guess> 101:</b></font></div><div><font size="2"><b>        print "Out of range!"</b></font></div><div><font face="CMR10" size="2"><br></font></div><div><font face="CMR10" size="2">def main():</font></div><div><font face="CMR10" size="2">    print_description()</font></div><div><font face="CMR10" size="2">    secret = randrange(1,101)</font></div><div><font face="CMR10" size="2">    current_guess = get_guess(1)</font></div><div><font face="CMR10" size="2">    if current_guess != secret:</font></div><div><font face="CMR10" size="2">        print_hints(secret_number, guess)</font></div><div><font face="CMR10" size="2">        current_guess = get_guess(2)</font></div><div><font face="CMR10" size="2">        </font></div><div><span style="font-family: CMR10; font-size: small;">    if secret == current_guess:</span></div><div><font face="CMR10" size="2">        print "Congratulations, you win!"</font></div><div><font face="CMR10" size="2">    else:</font></div><div><font face="CMR10" size="2">        print "Please play again"</font></div><div><font face="CMR10" size="2">    print "The secret number was", secret        </font></div><div><font face="CMR10" size="2">        </font><span style="font-family: CMR10; font-size: small;">    </span></div><div><span style="font-family: CMR10; font-size: small;">main()</span></div></div></div><div><div class="page" title="Page 4"><div class="layoutArea"><div class="column"><ol start="8"><li><ol style="list-style-type: none;"><li><div style="font-family: CMR10; font-size: 10pt;"><div class="page" title="Page 4"><div class="layoutArea"><div class="column"><ol start="8"><li style="font-size: 10pt;"><p><span style="font-size: 10pt;">Just below the body of the </span><span style="font-size: 10.000000pt; font-family: 'CMTT10'">get guess </span><span style="font-size: 10pt;">function, define a new function
named </span><span style="font-size: 10.000000pt; font-family: 'CMTT10'">print hints </span><span style="font-size: 10pt;">that takes two arguments. The first is a secret num-
ber and is kept in a parameter named </span><span style="font-size: 10.000000pt; font-family: 'CMTT10'">secret</span><span style="font-size: 10pt;">. The second is a guess made
by the user and it is held in a parameter named </span><span style="font-size: 10.000000pt; font-family: 'CMTT10'">guess</span><span style="font-size: 10pt;">.
</span></p>
                                                </li>
                                                <li style="font-size: 10pt;"><p><span style="font-size: 10pt;">The user’s guess is supposed to be within the range 1 ... 100. Write a
conditional statement that checks if the guess is out of that range, and if
it is print ‘out of range’ in the body of the </span><span style="font-size: 10.000000pt; font-family: 'CMTT10'">print hints </span><span style="font-size: 10pt;">function.
</span></p>
                                                </li>
                                                <li style="font-size: 10pt;"><p><span style="font-size: 10pt;">Now we are going to give the user the option to make a second guess.
You must add code to the </span><span style="font-size: 10.000000pt; font-family: 'CMTT10'">main </span><span style="font-size: 10pt;">function immediately after assignment
statement you wrote for task 7.
</span></p><p><span style="font-size: 10pt;">Write a conditional statement to check if the current guess does not match
the secret number. If the numbers to not match, in the body of the
conditional statement you will do two things.
</span></p>
                                                        <ol style="list-style-type: none">
                                                                <li><p><span style="font-size: 10pt;">(a)  call </span><span style="font-size: 10.000000pt; font-family: 'CMTT10'">print hints </span><span style="font-size: 10pt;">to give the user hints,
</span></p>
                                                                </li>
                                                                <li><p><span style="font-size: 10pt;">(b)  re-assign </span><span style="font-size: 10.000000pt; font-family: 'CMTT10'">current guess </span><span style="font-size: 10pt;">to the result of calling </span><span style="font-size: 10.000000pt; font-family: 'CMTT10'">get guess </span><span style="font-size: 10pt;">with an
</span></p><p><span style="font-size: 10pt;">argument of 2. </span></p>
                                                                </li>
                                                        </ol>
                                                </li>
                                        </ol>
                                </div>
                        </div>
                </div></div>
                                                                </li>
                                                        </ol>
                                                </li>
                                        </ol>
                                </div>
                        </div>
                </div></div></body></html>