Python ยท Lesson 5 of 5
๐งบ Lists
Keep many values together in one list.
A list holds many values in order, inside square brackets. The first item is at position 0.
fruits = ["mango", "apple", "banana"]
print(fruits[0])
fruits.append("grapes")
print(len(fruits), "fruits")OUTPUTmango
4 fruits
marks = [80, 65, 92]
print("Total:", sum(marks))
print("Best:", max(marks))OUTPUTTotal: 237
Best: 92
โ๏ธ Your turn
Open this example in the playground, change it and run it.
๐ง Quick quiz