KIIT Polytechnic logo Students Hub KIIT Polytechnic ସାଇନ୍ ଇନ୍
▲ବୋର୍ଡ ◆ନୋଟ୍ସ ≡ସିଲାବସ୍ ▦ଟାଇମଟେବଲ୍ ?ସନ୍ଦେହ ▶ରିଲ୍ସ 🎮ଶିଖନ୍ତୁ 🐍କୋର୍ସ ◈ସୁଯୋଗ ✍ବ୍ଲଗ୍ ▮ଷ୍ଟୋର୍ ★ଟିମ୍ ⌕ଖୋଜନ୍ତୁ
← Learn to Code — Python for Beginners ମଡ୍ୟୁଲ୍ · Put It Together

Lists

A list stores many values together, in order, under one name.

marks = [78, 85, 60, 92, 45]
print(marks[0])
print(marks[-1])
print(len(marks))

Python counts positions from 0, so marks[0] is the FIRST item, not the second. marks[-1] is a shortcut for "the last item."

You can loop over a list and do something with every item:

marks = [78, 85, 60, 92, 45]
total = 0
for m in marks:
    total = total + m
print("Average:", total / len(marks))

Try it: the starter code below does exactly this — run it, then change the marks to your own.