May I suggest running randint using 0, 1. The results can be tested like a
boolean. See what happens when you do an if test on 1 versus an if test on
0.
Also perhaps store your results in a dictionary with 'heads', 'tails' each
value set to 0.
On Sat, May 25, 2013 at 3:13 PM, Steven D'Aprano wro
On 25/05/13 19:25, Rafael Knuth wrote:
flips = 0
heads = 0
tails = 0
while flips < 10:
flips = flips + 1
Don't do this. It's not 1971 any more, we've had for loops for forty years :-)
Use while loops when you don't know how many loops you need. When you know how
many loops you will hav
On 25 May 2013 14:42, Ken G. wrote:
> May I suggest that instead of:
> how about:
>
> flips = heads = tails = 0
>
> Ken
How about flips = heads = 0
tails can then be calculated from flips - heads.
--
best regards,
Robert S.
___
Tutor maillist - Tutor@
On 05/25/2013 05:25 AM, Rafael Knuth wrote:
Gents,
thank you all for your help. One of you guys asked me to try out your
suggestions and then tell you how it goes. Here we go! First, let me
recap briefly what the expected outcome of my program was and which
difficulties I encountered at the beg
Gents,
thank you all for your help. One of you guys asked me to try out your
suggestions and then tell you how it goes. Here we go! First, let me
recap briefly what the expected outcome of my program was and which
difficulties I encountered at the beginning. I was writing a program
in Python 3.3.0