To add more fruits to the existing list in Python, you can use the append() method or the extend() method. Here are both methods:
Using append()
This method adds a single fruit to the end of the list.
fruits = ["apple", "banana", "cherry"]
fruits.append("orange") # Adds "orange" to the list
print(fruits)
Using extend()
This method adds multiple fruits at once.
fruits = ["apple", "banana", "cherry"]
fruits.extend(["orange", "grape"]) # Adds "orange" and "grape" to the list
print(fruits)
Output for both methods:
After using either method, the fruits list will look like this:
['apple', 'banana', 'cherry', 'orange'] # After append
['apple', 'banana', 'cherry', 'orange', 'grape'] # After extend
Feel free to try these methods, and let me know if you have any questions!
