title: How to use a function in another function in python
body: <p>I have to do a code where I need to create a game that gets the user to guess an equation. After the end of each guess I have to show how much of the equation the user has guessed. For example if the equation is 1+2*3+4 and the user guessed that the equation has 3 the program would say your guess is correct and so far the equation you have guessed is ----3-- (the dashes represent how many characters the equation has. if the user guesses 2 next I need the equation that they have guessed so far to be --2-3-- but i can't get them to accumulate.</p>
  
  <p>the functions that I am using are</p>
  
  <pre><code>def guessing1():
      '''
      the player is asked to make a guess and the result is printed
      '''
      wrongguesses=0
      if (guess1 in randomFormula):
           print "Your guess is correct!"
           wrongguesses=0
      else:
           print "Your guess is wrong!"
           wrongguesses +=1
           if (wrongguesses== max_guesses):
               print "Sorry, you've reached the maximum number of wrong guesses."
               print "Better luck next time!"
               playagain=raw_input("Do you want to play again? y-yes, n-no: ")
               if (playagain== n):
                  print "The game is over."  
  
  def formSoFar1():
     a=''
     for i in range (len(randomFormula)):
         if (randomFormula[i] == guess1):
             a += randomFormula[i]
         else:
            a+= "-"
     print "The formula you have guessed so far is: ",a
  </code></pre>
  
  <p>Any way that I change this code when I call the functions, I get either an error or it doesn't use the guesses from before. I'm not sure how to go about this.</p>