Course Content
Introduction to Python (generated task tests)
Introduction to Python (generated task tests)
Lists and List Methods
# A list showcasing various grocery categories grocery_items = ["milk", "eggs", "cheese", "butter"] print(grocery_items)
# A list containing information about the apple category # Each position holds different apple details: # Name, quantity, discount status, price, and origin apple_details = ["apple", 34, True, 1.99, "Fuji"] print(apple_details)
# Creating an inventory inventory = ["carrots", "bananas", "apples"] # Adding a new item inventory.append("oranges") # Removing an outdated item inventory.remove("bananas") # Sorting the inventory inventory.sort() # Checking the result print("Updated inventory:", inventory)
Everything was clear?
Thanks for your feedback!
SectionΒ 4. ChapterΒ 1