flip_coin = 100 and then after a while
while flip_coin != 100: It is contradicting.So the while loop is never executed. Just put flip_coin = 0 and remove head = "" tail = "" They are not necessary. It should work. Cheers, Sayan On 9 April 2013 17:20, Najam Us Saqib <ausn...@yahoo.com.au> 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. > > 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 > > -- -------------------------------------------------------------------------- *Sayan Chatterjee* Dept. of Physics and Meteorology IIT Kharagpur Lal Bahadur Shastry Hall of Residence Room AB 205 Mob: +91 9874513565 blog: www.blissprofound.blogspot.com Volunteer , Padakshep www.padakshep.org
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor