Python practice: Lists & Mutable Methods
Chapter 9 · 8 questions · included in full access
Question 1 · easy
Create and index products list
Solve it in your browserCreate a list
products = ["Laptop", "Monitor", "Desk", "Chair"]. Print the first item on line 1, and the last item on line 2:Question 2 · easy
Append and insert inventory items
Solve it in your browserGiven
items = ["Pen", "Paper"],.append("Stapler")to the end, then.insert(0, "Notebook")at the beginning. Printitems:Question 3 · easy
Pop last item
Solve it in your browserGiven
queue = ["Task 1", "Task 2", "Task 3"], remove the last task using.pop()intodone, and printdone:Question 4 · easy
Slice top three sales
Solve it in your browserGiven
sales = [120, 240, 310, 450, 520, 680], extract the first 3 items with slicing[0:3]and print the slice:Question 5 · easy
Reverse sequence with slicing
Solve it in your browserGiven
milestones = ["Q1", "Q2", "Q3", "Q4"], reverse the sequence usingmilestones[::-1]and print the reversed list:Question 6 · easy
Sort list descending
Solve it in your browserGiven
scores = [45, 82, 19, 94, 63], sort the list in descending order using.sort(reverse=True)and printscores:Question 7 · easy
Find extremes with min and max
Solve it in your browserGiven
daily = [1400, 2200, 950, 3100, 1800], printmin(daily)on line 1, andmax(daily)on line 2:Question 8 · medium
Calculate list average
Solve it in your browserGiven
ratings = [4.5, 3.8, 4.9, 4.2, 4.6], computeavg_rating = sum(ratings) / len(ratings). Printround(avg_rating, 2):
These questions are part of full access.
The first chapters of every track are free. Full access is a one-time payment.
See pricing