fruits = ["apple", "banana", "cherry"]
numbers = [10, 20, 30, 40, 50]
mixed = [1, "two", 3.0, True]
empty = []
fruits[0] # 'apple' — Python starts at 0
fruits[1] # 'banana'
fruits[-1] # 'cherry' — negative indexes count from the end
fruits[-2] # 'banana'
nums = [10, 20, 30, 40, 50]
nums[1:4] # [20, 30, 40]
nums[:3] # [10, 20, 30]
nums[3:] # [40, 50]
nums[:] # [10, 20, 30, 40, 50] — a copy
nums[::2] # [10, 30, 50] — every other one
fruits = ["apple", "banana"]
fruits.append("cherry") # add to the end
fruits.insert(0, "avocado") # insert at index 0
fruits.remove("banana") # remove by value
last = fruits.pop() # remove and return last
fruits[0] = "apricot" # replace by index
len(fruits) # how many items
"apple" in fruits # True/False
sorted(numbers) # returns a sorted copy
numbers.sort() # sorts in place
numbers.reverse()
sum(numbers) # 150
max(numbers) # 50
min(numbers) # 10
daily = [1200, 950, 1340, 1100, 1600, 0, 0] # Mon..Sun
daily.append(1450) # Monday of week 2
print(daily) # [1200, 950, 1340, 1100, 1600, 0, 0, 1450]
weekdays = daily[:5]
print(sum(weekdays)) # 6190
my_list[:] or list(my_list).
append, pop, insert, remove, sort — the workhorses.Given nums = [5, 2, 8, 1, 9, 3], write one line each to: