Adding Elements to a List in Python
In Python, one can easily add new elements to a list using the `append` method.
The `append` method places the new element at the end of the list:
- `namelist` refers to the list you're adding to.
- `item` represents the value you wish to add, which can be either numeric or alphanumeric.
Note. It's important to note that the new element is positioned immediately after the last item in the list.
A practical example
Start by creating an empty list named `city`:
Add an element to the list using the `append` method:
Add another element to the end:
To view the list's contents:
['New York', 'Rome']
As shown, the list now contains two elements.