title: how to write in multiple arguments to a txt file (strings and variables)
body: <p>I am trying to create a program that takes the start times and end times of word phrases, subtracts them to find the time length, and writes the length of each phrase into a file. i would like the final result to be "The length of phrase #(NumTrials) is: (length)" with length and numtrials being variables. I have tried a couple different approaches, but python is telling me that it is expecting only 1 argument for the write function. how could i modify this so that each phrase has it's length documented on a new line each time?  </p>
  
  <pre><code>from decimal import Decimal, getcontext
  getcontext().prec = 4
  def main():
      myfile = open('Phrases Compiled.txt', 'w')
      NumTrials = 0
      SumLength = 0
      StoreLengths = dict()
      response = input("are there more calculations you'd like to do?")
      while response != "no":
          if response in ['yes', 'y', 'Yes', 'Y']:
          start, stop = eval(input("what is the start and stop times of the phrase?"))
          start = Decimal(start)
          stop = Decimal(stop)
          length = stop - start
          StoreLengths[NumTrials] = length
          NumTrials += 1
          SumLength += length
          print(length)
          length = str(length)
          NumTrials = str(NumTrials)
          myfile.write("the length of phrase #", NumTrials, "is: ",length"\n")
          response = input("are there more calculations you'd like to do?")
      elif response in ['no', 'n', 'N', 'No']:
          print("calculations are done")
          break 
  averagelength = SumLength/NumTrials
  print("average length was:", averagelength)
  </code></pre>
  
  <p>main()</p>