title: How to calculate user input in python
body: <p>I am supposed to write a program in Python that asks for grades one at a time. When the user enters “done” , calculate the following: grade average.</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>def main():
      user_input = input("Enter grade: ") 
      number = user_input
      while True:
          user_input = input("Enter grade: ")
          if user_input == "done":
              break
      avg(number)
  
  def avg(a):
      average = sum(a)/len(a)
      print(average)
  
  if __name__ == "__main__":
      main()
  </code></pre>
  
  <p>Whenever I enter "done," the program gives me this error.</p>
  
  <blockquote>
    <p>TypeError: 'int' object is not iterable</p>
  </blockquote>
  
  <p>I have tried changing the user_input variable to :</p>
  
  <blockquote>
    <p>user_input = int(input("Enter grade: "))</p>
  </blockquote>
  
  <p>But, another error: TypeError: </p>
  
  <blockquote>
    <p>'int' object is not iterable user input</p>
  </blockquote>
  
  <p>I am extremely new to programming. Can anyone help me work this out? I have been searching online for the past two hours and have not found anything that did not just produce another error.</p>