TankorSmash

Untitled

Jul 3rd, 2012
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import random
  2.  
  3. heads = 0
  4. tails = 0
  5.  
  6. #this is a loop, so everything in here gets re-called everytime
  7. # you used to only call randint() once
  8. while heads + tails != 100:
  9.     coin = random.randint(1,2)
  10.     print(coin)
  11.     if coin == 1:
  12.         heads += 1
  13.  
  14.     elif coin == 2:
  15.         tails += 1
  16.  
  17. print("You flipped",heads,"heads and",tails,"tails.")
Advertisement
Add Comment
Please, Sign In to add comment