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. 

The Problem:

Create a program that flips a coin 100 times and than tells you the number of 
tails and heads.

My code:

# Flip a coin

import random

flip_coin = 100
head = ""
tail = ""
n_head = 0
n_tail = 0
the_num = (raw_input("Press enter key to flip the coin!"))


#raw_input("Please Flip the Coin")

while flip_coin != 100:
    flip_coin = random.randrange(100) +1 
    if flip_coin <= 50:
         
     print "head"
    
    else: 
     print "tail"
    
    the_num = (raw_input("Press Enter to flip the coin"))
    n_head += 1
    n_tail += 1
    
    

print "The total numbers of heads are" ,n_head
print "The total numbers of tails are" ,n_tail

raw_input("\n\nPress the enter key to exit, thank you")

Thank you very much, looking forward to hear from you.

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

Reply via email to