...

/

عمليات القائمة المشتركة

عمليات القائمة المشتركة

استكشف بعض الخصائص والأدوات المساعدة المضمنة في بنية بيانات القائمة.

سنغطي ما يلي...

Adding elements

All the elements of a list cannot always be specified beforehand and there’s a strong possibility that we’ll want to add more elements during runtime.

The append() method can be used to add a new element at the end of a list. The following template must be followed:

a_list.append(newElement)

Here’s an example:

Press + to interact
num_list = [] # Empty list
num_list.append(1)
num_list.append(2)
num_list.append(3)
print(num_list)

Note: In the code above, we create an empty list at line 1. This can always be done ...