title: Consecutive Coin Flip Counting in Python
body: <p>I'm new to programming and have encountered an error that I can't seem to debug, no matter what alterations I make. I'm attempting to write a function that allows the user to specify the number of flips and the length of a consecutive streak of coin flips. The program is supposed to count the number of times that the streak (heads or tails) occurs. When I run my current program, I return a value of 1 for both heads and tails:</p>
  
  <pre><code>import random
  
  def flip():
      flipValue = random.randint(1,2)
      if flipValue == 1:
          side = "Heads"
      else:
          side = "Tails"
      return side
  
  def nStreak():
      numFlips = int(input("Number of flips:"))
      lengthStreak = int(input("Length of streak:"))
      numRuns = 0
      heads = 0
      tails = 0
      numStreakHeads = 0
      numStreakTails = 0
      while numRuns != numFlips:
          side = flip()
          numRuns += 1
          if side == "Heads":
              heads += 1
              if heads == lengthStreak:
                  numStreakHeads += 1
          if side == "Tails":
              tails += 1
              if tails == lengthStreak:
                  numStreakTails += 1
      print("Number of heads streaks:", numStreakHeads)
      print("Number of tails streaks:", numStreakTails) 
  </code></pre>