Home > Enterprise >  How we can find the length of the list
How we can find the length of the list

Time:04-15

we want to find the average of items of the list. List is given below

marks=[45,87,45,56,54]
    print(sum(marks)/len.marks())

CodePudding user response:

marks=[45,87,45,56,54]
print(sum(marks)/len(marks))

CodePudding user response:

You can try to use this:

marks = [45,87,45,56,54]

def avg(l):
    return sum(l) / len(l)

print(avg(marks))
  • Related