<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1250">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7036.0">
<TITLE>RE: [Tutor] python problem</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">Here some more work:</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><B></B></SPAN><SPAN LANG="en-us"><B></B></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><B></B></SPAN><SPAN LANG="en-us"><B><FONT FACE="Courier New">guess = 0</FONT></B></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><B><FONT FACE="Courier New">Print ‘Pick a number between 0 and 100’</FONT></B></SPAN></P>
<BR>

<P DIR=LTR><SPAN LANG="en-us"><B><FONT FACE="Courier New">While guess != ________ :</FONT></B></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT FACE="Courier New">print ‘My first guess is ‘, guess</FONT></B></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT FACE="Courier New">print ‘Is my guess correct?’</FONT></B></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT FACE="Courier New">if guess = = type3</FONT></B></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT FACE="Courier New">print ‘I got it!’&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></B></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT FACE="Courier New">if guess &gt; _______:</FONT></B></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT FACE="Courier New">pick lower #</FONT></B></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT FACE="Courier New">if guess &lt;_______ :</FONT></B></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT FACE="Courier New">pick higher #</FONT></B></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><B><FONT FACE="Courier New">that’s all I can do right now…</FONT></B></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><B><FONT FACE="Courier New">the mechanism that I can’t figure out is how to show in code form how the computer goes to the next guess using the split range... ie. if the first guess is 50, the second guess would be taken from the 50-100 (50/2 = 25 + 50 = 75) second guess&nbsp; would be 75 if the number is too high.&nbsp; If the number falls below 50, then the split range is 25, ect…</FONT></B></SPAN><SPAN LANG="en-us"><B></B></SPAN><SPAN LANG="en-us"><B></B></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">-----Original Message-----<BR>
From: bhaaluu [<A HREF="mailto:bhaaluu@gmail.com">mailto:bhaaluu@gmail.com</A>]<BR>
Sent: Wednesday, September 26, 2007 5:13 AM<BR>
To: Chris<BR>
Cc: tutor@python.org<BR>
Subject: Re: [Tutor] python problem</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">Greetings Chris,</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">On 9/25/07, Chris &lt;balderas@whtvcable.com&gt; wrote:</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">&gt;</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">&gt;&nbsp;&nbsp; Ok as I see it, it's should go like this:</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">&gt;</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">&gt; Print 'Think of a number between 1 and 100, and let me guess it'</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">&gt;</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">&gt; Type1 = input ('Type 1 if I am high')</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">&gt; Type2 = input ('Type 2 if I am low')</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">&gt; Type3 = input ('Type 3 if I am dead on')</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">&gt;</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">&gt; I can't seem to get the guts of it.&nbsp; I assume that there are 3 if statements</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">&gt; and a while statement.</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">&gt;</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">&gt; guess</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">&gt;</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">&gt; While x !=</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If guess</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">&gt;</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">&gt;</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">&gt;</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">&gt; I get lost right around here...help!</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">Thunk! er, Think! =)</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">Play the guess-a-number game, and jot down exactly what YOU do</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">to make a guess.</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">Prompt:&gt; Think of a number between 1 and 100. Got it?</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">Prompt:&gt; Okay, now I, the Great Computer, will guess the number...</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">Prompt:&gt; Is the number 51?</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">Prompt:&gt; 0=Correct, 1=Lower, 2=Higher: _</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">The range is 1 to 100. Let's say you think of the number 37.</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">At he prompt, you type 1 because the number is Lower than 51.</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">(or whatever scheme you decide to use.)</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">If you were playing against the computer, and the computer told you</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">to guess Lower, what would you do? Would you guess 50? 49? 10? 1?</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">How do you guess when you're playing the game?</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">How do you narrow it down? Figure it out.</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">So, now you think you can outsmart the computer half-way through</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">the game by thinking of a different number, say 38.... Pretty sneaky!</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">That's like palming the pea in a shell game. Granted, the Great</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">Computer, isn't very smart... but it IS an idiot savant. It can remember</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">tons of information that you've forgotten as irrelevant just seconds ago.</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">So what the Great Computer has been doing, while guessing, is keeping</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">track of the bounds it can guess between, from the hints you've been</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">providing [0,1,2, whatever] and maybe even a list of all its guesses that</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">were not correct. And in a split second, it can compare all that stuff.</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">Chris, what constraints are you working under? How many Python 'tools'</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">(keywords, methods, etc.) do you have to solve the problem with?</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">Input? [raw_inpu(), input(), ...], Output? [print, ...], Selection?</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">[if, elif, else, ...]</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">Iteration? [for, while, ...]. You also have to consider what you have</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">to work with</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">so far.</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">-- </FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">b h a a l u u at g m a i l dot c o m</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"><A HREF="http://www.geocities.com/ek.bhaaluu/index.html">http://www.geocities.com/ek.bhaaluu/index.html</A></FONT></SPAN></P>
<BR>

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Times New Roman">No virus found in this outgoing message.<BR>
Checked by AVG Free Edition.<BR>
Version: 7.5.487 / Virus Database: 269.13.25/1018 - Release Date: 9/19/2007 3:59 PM<BR>
</FONT>&nbsp;</SPAN>
</P>

</BODY>
</HTML>