Hello tutor

I downloaded a guide about learning Python by Michael Dawson which has 
challenges at the end of each chapter. I'm a novice so I encountered a problem 
with this challenge:

"Write a program that flips a coin 100 times and then tells 
you the number of heads and tails."
I wrote this code but I know its wrong. Although it works properly:

flips=0
h='heads'
t='tails'
while True:
    flips+=1
    if flips>100:
        break
    if True:
        print(flips,'=',h or t)

But it prints every number with the string 'heads'. I'm really blank at this. 
It may have something to do with the 'random' module.

Regards




      
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to