I am fairly new to python and was wondering how to make this loop run for a the number of iterations that is entered by the user, however it is an infinite loop at the moment:
def randMod():
import random
heads = 0
tails = 0
tries = raw_input('Enter a number:')
while True:
runs = 0
if tries == runs:
break
else:
runs + 1
coinFlip = random.randrange(0,1+1)
if coinFlip == 0:
print "Tails"
tails + 1
elif coinFlip == 1:
print "Heads"
heads + 1
print heads
print tails
randMod()
I am trying to make it so it will simulate a coin flip for how many times the user enters then tallies it at the end. Only problem is I am fairly new to python so I don't know if I got this right or not.