[Tutor] Flip a coin
Steven D'Aprano
steve at pearwood.info
Tue Apr 9 14:18:17 CEST 2013
On 09/04/13 21:50, Najam Us Saqib wrote:
> Hi,
>
> This program is killing me, I have been working on it for last 3 hours, I have tried my best but can't make it work, please help me out.
Would you like to tell us what it is doing wrong, or should we guess?
My guess is below:
> flip_coin = 100
Here you set flip_coin to 100.
> while flip_coin != 100:
Here you test whether flip_coin is not equal to 100. Since it is 100, the while loop is skipped, and nothing you write inside the while loop is executed at all.
If you want to run something 100 times, use a for loop:
for i in range(100):
do_something()
--
Steven
More information about the Tutor
mailing list