Trying to average a list, but I don't know what is meant by the error: unsupported operand type(s) for +: 'int' and 'tuple'
<pre><code>First_Name = input("What is your first name: ")
Last_Name = input("what is your Last Name: ")
print ("Hello, let's see what your grades are like", First_Name, Last_Name,     ",you degenerate!")

grade_one = int(input("Enter your first grade: "))
grade_two = int(input("Enter your second grade: "))
grade_three = int(input("Enter your third grade: "))
grade_four = int(input("Enter your fourth grade: "))
grade_five = int(input("Enter your fith grade: "))
grades = grade_one,grade_two,grade_three,grade_four,grade_five
Grade_list.append(grades)
print (Grade_list)

def average(numbers):
   total = sum(numbers)
   total = float(total)
   results = total/len(numbers)
   return results 
print (average(Grade_list))
</code></pre>

<p>Basically what I'm trying to accomplish here is getting the average of a list of grades input by the user, which I then converted to a list. But I can seem to average the list no matter how many different techniques I've used (Granted i'm very new to this, so I probably just haven't employed the proper technique). I keep coming across the error:</p>

<pre><code>Traceback (most recent call last):
  File "python", line 23, in &lt;module&gt;
  File "python", line 19, in average
TypeError: unsupported operand type(s) for +: 'int' and 'tuple'
</code></pre>

<p>I'm not sure what this error means, I have an idea that my list is printing as a tuple when it should be printing as a consecutive list of integers. I'm not sure how to go about fixing that though (or if that's even the issue). Thanks in advance! I realize my code probably isn't the most efficient piece of code out there, i'm certainly open to suggestions! :). This is a school assignment so it's not exactly rocket science i'm aware, but I can't seem to wrap my head around this.</p>

<h1>Explanation</h1>

<p>That is because you are creating a tuple at this line: </p>

<pre><code>grades = grade_one,grade_two,grade_three,grade_four,grade_five
</code></pre>

<p>If you set a <code>print(grades)</code> right after that line, you will see your output is, for example: </p>

<pre><code>(56, 56, 56, 56, 56)
</code></pre>

<p>So, when you call this: </p>

<pre><code>Grade_list.append(grades)
</code></pre>

<p>You are now creating a list with a single tuple inside it: </p>

<pre><code>[(56, 56, 56, 56, 56)]
</code></pre>

<p>So, when you call your method, you are trying to perform your calculation against the tuple, which is exactly where your error message is coming from.</p>

<h1>Solution</h1>

<p>To strictly focus on your code, what you should be doing instead, is after each entry you are asking is append each answer to your <code>Grade_list</code> instead. </p>

<p>For example, to show a snippet of your code of what you should do: </p>

<pre><code>grade_one = int(input("Enter your first grade: "))
Grades_List.append(grade_one)
grade_two = int(input("Enter your second grade: "))
Grades_List.append(grade_two)
</code></pre>

<p>and so on...</p>

<p>Now, for the suggestion of how to improve what you are doing. What you should do instead, is loop over your question until you have exhausted how many times you want to ask the user for their grades and just append to the list, so you don't have to create several variables to do all this.</p>

<p>So, your entire chunk of code where you ask the user for their grades can be replaced with: </p>

<pre><code>Grade_list = []
for grade_number in range(1, 6):
    grade = int(input("Enter grade {}: ".format(grade_number)))
    Grade_list.append(grade)
</code></pre>

<p>When running the updated code, with the changes, we get:</p>

<pre><code>What is your first name: bob
what is your Last Name: hope
Hello, let's see what your grades are like bob hope ,you degenerate!
Enter grade 1: 44
Enter grade 2: 44
Enter grade 3: 44
Enter grade 4: 44
44.0
</code></pre>

python list compiler-errors