Python Lab Manual / Lists in Python Program

Program Name

Write a Python Program for Lists.
Theory
Lists are used to store multiple items in a single variable. Lists can be sort,display, modify and delete.
Program Code


Input:
List Array
Enter array elements:1 2 3 4
List Array Elements 1
List Array Elements 2
List Array Elements 3
List Array Elements 4

Delete element from list
Enter Numbers:1 2
Enter the element to delete1
[2, None]

Sort list
Enter Numbers:4 2 3 1
[1, 2, 3, 4]

Print element less than given(key) element
Enter array elements:1 2 3 4
Enter a number:3
1 2 
Output:
List Array
Enter array elements:1 2 3 4
List Array Elements 1
List Array Elements 2
List Array Elements 3
List Array Elements 4

Delete element from list
Enter Numbers:1 2
Enter the element to delete1
[2, None]

Sort list
Enter Numbers:4 2 3 1
[1, 2, 3, 4]

Print element less than given(key) element
Enter array elements:1 2 3 4
Enter a number:3
1 2 


Home     Back