[Tutor] While Loops: Coin Flip Game

Steven D'Aprano steve at pearwood.info
Sun Nov 14 23:52:07 CET 2010


Dawn Samson wrote:

> I've been trying to work on this challenge for a while now and can't
> get it to work (either it has 100 heads or 100 tails). 

Unfortunately your code has been mangled in the email, but I can guess 
your problem: you need to set

coin = random.randrange(2)

each time through the loop, not just once outside the loop.



-- 
Steven


More information about the Tutor mailing list