0% found this document useful (0 votes)
2 views

Python List

The document provides a series of Python programming tasks related to list manipulation. Tasks include adding elements, joining lists, sorting, deleting, inserting, copying, clearing, finding length, concatenating using a loop, and sorting in descending order. Each task specifies the initial list and the expected operation to be performed.

Uploaded by

b5mj96y2wp
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Python List

The document provides a series of Python programming tasks related to list manipulation. Tasks include adding elements, joining lists, sorting, deleting, inserting, copying, clearing, finding length, concatenating using a loop, and sorting in descending order. Each task specifies the initial list and the expected operation to be performed.

Uploaded by

b5mj96y2wp
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

 Adding Elements to a List:

 Write a Python program to create an empty list. Then, add the following
elements to the list: 15, 25, 35, and 45. Finally, print the list.
 Joining Two Lists:
 Create two lists: list1 = [10, 20, 30] and list2 = [40, 50, 60]. Write a
Python program to join both lists and print the result.
 Sorting a List:
 Write a Python program that takes a list of numbers: [12, 5, 7, 3, 9, 1] and
sorts it in ascending order. Print the sorted list.
 Deleting an Element from a List:
 Given the list my_list = [100, 200, 300, 400, 500], write a Python program
to remove the number 300 from the list. Then print the updated list.
 Inserting an Element into a List:
 Write a Python program that takes the list [1, 2, 4, 5] and inserts the
number 3 between 2 and 4. Print the updated list.
 Copying a List:
 Given a list fruits = ['apple', 'banana', 'cherry'], write a Python program to
create a copy of this list and print the copied list.
 Clearing a List:
 Write a Python program to clear the entire list numbers = [5, 10, 15, 20]
so that it becomes empty. Print the list after clearing it.
 Finding the Length of a List:
 Write a Python program to find and print the length of the list colors =
['red', 'green', 'blue', 'yellow'].
 Concatenating Lists Using a Loop:
 Write a Python program to concatenate two lists a = [1, 2, 3] and b = [4,
5, 6] using a loop. Print the final concatenated list.
 Sorting a List in Descending Order:
 Given the list grades = [85, 90, 78, 92, 88], write a Python program to sort
the list in descending order and print the result.

You might also like