Starlit Daily

📚 › Python: the friendliest first language

5. Lists

ستتم ترجمة هذا المقال تلقائيًا. يُعرض بالإنجليزية حاليًا.

A list holds items in order, inside square brackets. Positions start at 0. len(list) gives the count and append adds an item to the end.

Lists can change, so you can add, remove and replace items.

عرض المثال

fruits = ["mango", "banana"]
fruits.append("jackfruit")
print(fruits[0], len(fruits))

✍️ دورك الآن

Make a list of 3, 8 and 10, then print its length.

← العودة إلى الدورة