# how to calculate average of total? it's giving an error can someone tell me how to solve it?

subject=['Eng','Bio','Mth','Chem','phy']
total=[]
average=0
for item in subject:
item=int(input('Enter score:'))
total.append(item)
average=float(total/5)
print(item)
print(sum(total))
print(average)

Output:

average=float(total/5) TypeError: unsupported operand type(s) for /: 'list' and 'int'

answered Mar 17, 2020 by anonymous

subject=['Eng','Bio','Mth','Chem','phy']
total=[]
average=0
for item in subject:
item=int(input('Enter score:'))
total.append(item)
sum=0
for i in total:
sum=sum+i
number=len(subject)
average=float(sum/number)
print("average:%d"%average)
commented Mar 17, 2020 by anonymous
answered Mar 16, 2020 by A helping coder
Try making the parentheses so that it only wraps around total. I think the reason for the error is that python canâ€™t convert the slash to float.
commented Mar 17, 2020 by anonymous
i tried  your suggestion but it  is still showing an error. Thank  you for suggesting though.