Python practice: Lists & Mutable Methods

Chapter 9 · 8 questions · included in full access

  1. Question 1 · easy

    Create and index products list

    Create a list products = ["Laptop", "Monitor", "Desk", "Chair"]. Print the first item on line 1, and the last item on line 2:

    Solve it in your browser
  2. Question 2 · easy

    Append and insert inventory items

    Given items = ["Pen", "Paper"], .append("Stapler") to the end, then .insert(0, "Notebook") at the beginning. Print items:

    Solve it in your browser
  3. Question 3 · easy

    Pop last item

    Given queue = ["Task 1", "Task 2", "Task 3"], remove the last task using .pop() into done, and print done:

    Solve it in your browser
  4. Question 4 · easy

    Slice top three sales

    Given sales = [120, 240, 310, 450, 520, 680], extract the first 3 items with slicing [0:3] and print the slice:

    Solve it in your browser
  5. Question 5 · easy

    Reverse sequence with slicing

    Given milestones = ["Q1", "Q2", "Q3", "Q4"], reverse the sequence using milestones[::-1] and print the reversed list:

    Solve it in your browser
  6. Question 6 · easy

    Sort list descending

    Given scores = [45, 82, 19, 94, 63], sort the list in descending order using .sort(reverse=True) and print scores:

    Solve it in your browser
  7. Question 7 · easy

    Find extremes with min and max

    Given daily = [1400, 2200, 950, 3100, 1800], print min(daily) on line 1, and max(daily) on line 2:

    Solve it in your browser
  8. Question 8 · medium

    Calculate list average

    Given ratings = [4.5, 3.8, 4.9, 4.2, 4.6], compute avg_rating = sum(ratings) / len(ratings). Print round(avg_rating, 2):

    Solve it in your browser

These questions are part of full access.

The first chapters of every track are free. Full access is a one-time payment.

See pricing