Python Lists Practice Questions with Solutions

Lists are one of the most useful data structures in Python. They allow you to store multiple values in a single variable and perform operations such as adding, removing, updating, sorting, and searching elements. In this Python Lists practice questions with solutions set, you’ll solve beginner-friendly list programs with complete solutions.


1. Python Program to Create and Print a List

Difficulty: Foundation

Problem Statement

Write a Python program to create a list of five fruits and print the complete list.

Python Solution

fruits = ["Apple", "Banana", "Mango", "Orange", "Grapes"]

print(fruits)

Sample Output

['Apple', 'Banana', 'Mango', 'Orange', 'Grapes']

Explanation

A list stores multiple values in a single variable using square brackets [].

Concepts Covered

  • Creating Lists
  • List Syntax

2. Python Program to Access List Elements

Difficulty: Foundation

Problem Statement

Write a Python program to print the first, third, and last element of a list.

Python Solution

colors = ["Red", "Blue", "Green", "Yellow", "Black"]

print("First:", colors[0])
print("Third:", colors[2])
print("Last:", colors[-1])

Sample Output

First: Red
Third: Green
Last: Black

Explanation

List elements are accessed using index numbers. Negative indexing starts from the end of the list.

Concepts Covered

  • List Indexing
  • Negative Indexing

3. Python Program to Add an Item to a List

Difficulty: Foundation

Problem Statement

Write a Python program to add "Python" to the end of a list.

Python Solution

courses = ["Java", "C++", "JavaScript"]

courses.append("Python")

print(courses)

Sample Output

['Java', 'C++', 'JavaScript', 'Python']

Explanation

The append() method adds a new element at the end of a list.

Concepts Covered

  • append()

4. Python Program to Insert an Item at a Specific Position

Difficulty: Foundation

Problem Statement

Write a Python program to insert "HTML" at index 1.

Python Solution

courses = ["Python", "Java", "C++"]

courses.insert(1, "HTML")

print(courses)

Sample Output

['Python', 'HTML', 'Java', 'C++']

Explanation

The insert() method adds an element at the specified position.

Concepts Covered

  • insert()

5. Python Program to Remove an Item from a List

Difficulty: Practice

Problem Statement

Write a Python program to remove "Orange" from the list.

Python Solution

fruits = ["Apple", "Orange", "Banana", "Mango"]

fruits.remove("Orange")

print(fruits)

Sample Output

['Apple', 'Banana', 'Mango']

Explanation

The remove() method deletes the specified element from the list.

Concepts Covered

  • remove()

6. Python Program to Find the Largest Number in a List

Difficulty: Practice

Problem Statement

Write a Python program to find the largest number in a list.

Python Solution

numbers = [25, 60, 18, 95, 42]

print("Largest Number:", max(numbers))

Sample Output

Largest Number: 95

Explanation

The max() function returns the largest value in the list.

Concepts Covered

  • max()

7. Python Program to Find the Sum of All List Elements

Difficulty: Practice

Problem Statement

Write a Python program to calculate the sum of all numbers in a list.

Python Solution

numbers = [10, 20, 30, 40, 50]

print("Sum:", sum(numbers))

Sample Output

Sum: 150

Explanation

The sum() function calculates the total of all numeric values in the list.

Concepts Covered

  • sum()

8. Python Program to Sort a List in Ascending Order

Difficulty: Challenge

Problem Statement

Write a Python program to sort a list in ascending order.

Python Solution

numbers = [45, 12, 78, 23, 9]

numbers.sort()

print(numbers)

Sample Output

[9, 12, 23, 45, 78]

Explanation

The sort() method arranges list elements in ascending order.

Concepts Covered

  • sort()

9. Python Program to Reverse a List

Difficulty: Challenge

Problem Statement

Write a Python program to reverse the elements of a list.

Python Solution

numbers = [10, 20, 30, 40, 50]

numbers.reverse()

print(numbers)

Sample Output

[50, 40, 30, 20, 10]

Explanation

The reverse() method changes the order of list elements.

Concepts Covered

  • reverse()

10. Python Program to Count the Occurrences of an Element in a List

Difficulty: Challenge

Problem Statement

Write a Python program to count how many times a specific element appears in a list.

Python Solution

numbers = [10, 20, 30, 20, 40, 20]

count = numbers.count(20)

print("Occurrences:", count)

Sample Output

Occurrences: 3

Explanation

The count() method returns the number of times an element appears in the list.

Concepts Covered

  • count()

Chapter Summary

After completing this chapter, you have learned:

  • Creating lists
  • Accessing list elements
  • List indexing
  • Negative indexing
  • append()
  • insert()
  • remove()
  • max()
  • sum()
  • sort()
  • reverse()
  • count()

Written by Shubhranshu Shekhar, who has trained 20000+ students in coding.

Scroll to Top