0% found this document useful (0 votes)
3 views2 pages

Python List Function Practice Tasks

The document contains a series of practice questions focused on Python list functions. Each question requires writing a Python program to perform specific operations on lists, such as appending, inserting, removing elements, and sorting. The tasks range from basic list manipulations to more complex operations involving user input and list methods.

Uploaded by

naruka2494
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Python List Function Practice Tasks

The document contains a series of practice questions focused on Python list functions. Each question requires writing a Python program to perform specific operations on lists, such as appending, inserting, removing elements, and sorting. The tasks range from basic list manipulations to more complex operations involving user input and list methods.

Uploaded by

naruka2494
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Python List Function – Practice Questions

1. Write a Python program to append an element "Apple" at the end of the list
["Banana", "Mango", "Orange"].

2. Write a Python program to insert the string "Python" at index 2 in the list ["Java",
"C++", "Ruby", "HTML"].

3. Write a Python program to extend the list ["Red", "Green"] by adding another list
["Blue", "Yellow"].

4. Write a Python program to remove the first occurrence of "Cat" from the list ["Dog",
"Cat", "Tiger", "Cat", "Lion"].

5. Write a Python program to remove the element at index 3 from the list [10, 20, 30,
40, 50] using pop().

6. Write a Python program to find the index of the string "Rose" in the list ["Lily",
"Rose", "Tulip", "Jasmine"].

7. Write a Python program to count how many times "India" occurs in the list ["India",
"USA", "India", "UK", "India"].

8. Write a Python program to sort the list ["Banana", "Apple", "Mango",


"Orange"] in alphabetical order.

9. Write a Python program to reverse the list [100, 200, 300, 400].

10. Write a Python program to make a copy of the list ["Red", "Blue", "Green"]
using copy().

11. Write a Python program to clear all elements from the list ["Monday", "Tuesday",
"Wednesday"].

12. Write a Python program to append a new fruit name entered by the user to the list
["Apple", "Mango"].
13. Write a Python program to insert a student name at the beginning of the list
["Rahul", "Neha", "Aman"].

14. Write a Python program to extend the list [1, 2, 3] by adding strings ["Four",
"Five"].

15. Write a Python program to remove a city name entered by the user from the list
["Delhi", "Mumbai", "Chennai", "Kolkata"].

16. Write a Python program to remove and print the last element of the list ["Pen",
"Pencil", "Eraser", "Sharpener"].

17. Write a Python program to find the index of the first occurrence of "Blue" in the list
["Red", "Blue", "Green", "Blue"].

18. Write a Python program to sort the list of numbers [90, 20, 50, 10, 70] in
descending order.

19. Write a Python program to reverse the list of subjects ["Maths", "Science",
"English", "History"].

20. Given the list:


countries = ["India", "Canada", "Australia", "Germany", "Brazil",
"Japan"]
Perform the following tasks:
○ Print the whole list.
○ Delete the country "Germany" from the list.
○ Add "USA" at the end of the list.
○ Remove the item at the 2nd position (index 1).
○ Sort the list in ascending order.

21. Given the list:


numbers = [45, 12, 78, 34, 90, 23]
Perform the following tasks:
○ Print the whole list.
○ Delete the number 78 from the list.
○ Add 100 at the end of the list.
○ Remove the item at the 2nd position (index 1).
○ Sort the list in ascending order.

You might also like