0% found this document useful (0 votes)
2 views1 page

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
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

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
We take content rights seriously. If you suspect this is your content, claim it here.
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

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy