TOPIC 5: Python Lists
Completion requirements
3. Changeable Lists & Allow Duplicates
Changeable Lists
Lists are changeable.
This means that after creating a list, we can modify, add, or remove items from it.
Example:
thislist = ["apple", "banana", "cherry"]
thislist[1] = "orange"
print(thislist)
Output:
['apple', 'orange', 'cherry']
Allow Duplicates
Lists allow duplicate values.
This means that the same item can appear more than once in a list.
Example:
thislist = ["apple", "banana", "cherry", "apple", "cherry"]
print(thislist)
Output:
['apple', 'banana', 'cherry', 'apple', 'cherry']