myFile.write(item+"\n") TypeError: unsupported operand type(s) for +: 'int' and 'str'
<p>Getting error:</p>

<blockquote>
  <p>myFile.write(item+"\n") TypeError: unsupported operand type(s) for +:
  'int' and 'str'</p>
</blockquote>

<p>and not sure why. Where shall I add the <code>int</code>? This is my code</p>

<pre><code>#comment program to create a list in a file
numberList = []
for counter in range (1,7):
    number = int(input("choose a number")) #asks user to enter 6 numbers
    numberList.append(number) #stores the numbers in a list

#writes numbers to a file
myFile = open('numbers.txt','w')
for item in numberList:
    myFile.write(item+"\n")

myFile = open('numbers.txt','rt')
contents = myFile.read()
print(contents)
numSum = sum(numberList)
print(numSum)
sumTimesSum = sum * sum
average = SumTimesSum / 6
print(average)

myFile.close()
</code></pre>