Thankyou..!!!<br><br><br>Regards,<br>Nithya<br><br><div class="gmail_quote">On Tue, Nov 16, 2010 at 1:51 PM, Luke Pettit <span dir="ltr">&lt;<a href="mailto:petluke@gmail.com">petluke@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Arrr thats better <span style="font-family: arial,sans-serif; font-size: 13px; border-collapse: collapse; color: rgb(121, 6, 25); font-weight: bold; white-space: nowrap;">Nithya</span><font face="arial, sans-serif"><span style="border-collapse: collapse; white-space: nowrap;"> it works fine now. I had it working fine before it was just coming up with that strange result of 73 and 100 </span></font><div>

<font face="arial, sans-serif"><span style="border-collapse: collapse; white-space: nowrap;">when I copied the code into wing to check it out in order to understand it. Wing picked up the spacing and I had already corrected</span></font></div>

<div><font face="arial, sans-serif"><span style="border-collapse: collapse; white-space: nowrap;">that Dave as I was simply looking at Nithya code.</span></font><div><div></div><div class="h5"><br>
<br><div class="gmail_quote">On 16 November 2010 19:10, Nithya Nisha <span dir="ltr">&lt;<a href="mailto:nithyakarpagam@gmail.com" target="_blank">nithyakarpagam@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Hi there,<br><br>This is the Code. Please check it.It is working fine.<br><br>&gt;&gt;&gt;import random<br>
&gt;&gt;&gt;headsCount = 0<br>&gt;&gt;&gt;tailsCount = 0<br>&gt;&gt;&gt;count = 1<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;while count &lt;= 100:<br>&gt;&gt;&gt;       coin = random.randrange(2)<br>&gt;&gt;&gt;       if coin == 0:<br>


&gt;&gt;&gt;             headsCount += 1<br>&gt;&gt;&gt;       else:<br>&gt;&gt;&gt;             tailsCount += 1<br>&gt;&gt;&gt;       count += 1<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;print &quot;The number of heads was&quot;, headsCount<br>


&gt;&gt;&gt;print &quot;The number of tails was&quot;, tailsCount<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;raw_input(&quot;\n\nPress the enter key to exit.&quot;)<br><br>________________________________________________________________________________________________________________<u><b><br>


Your Description </b></u>:<br><br><div class="gmail_quote">On Tue, Nov 16, 2010 at 1:25 PM, Dave Angel <span dir="ltr">&lt;<a href="mailto:davea@ieee.org" target="_blank">davea@ieee.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


<div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
When I run this code (I&#39;m also a noob) I get this result:-<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
[evaluate lines 1-22 from untitled-1.py]<br>
</blockquote></blockquote></blockquote>
The number of heads was 73<br>
The number of tails was 100<br>
<br>
Press the enter key to exit.<br>
<br>
# Surely, if flipping a single coin 100 times your total number of heads and<br>
tails should add up to 100<br>
# not 173 or am I missing the point?<br>
<br>
<br>
</blockquote></div>
No, you&#39;re missing an indentation.  If you check the code you&#39;re running, I think you&#39;ll find that you didn&#39;t unindent the line incrementing count.<br>
<br>
Of course, it&#39;s less error prone to simply use<br>
for count in xrange(100):<br>
<br>
instead of while count &lt; 100:<br>
<br>
and you wouldn&#39;t need to increment count.<br>
<br>
DaveA<br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>With Regards,<br>Nithya S<br><br>
</blockquote></div><br><br clear="all"><br></div></div>-- <br>Luke Pettit<br>
</div>
</blockquote></div><br><br clear="all"><br><br>