From cbf0d0087afb671bdea528ab1cc0a18078b9fb65 Mon Sep 17 00:00:00 2001 From: Sindhuja Golagani Date: Fri, 27 Feb 2026 18:35:00 +0530 Subject: [PATCH] Add list operations: insert, count, and extend --- Programs/P03_ListsOperations.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Programs/P03_ListsOperations.py b/Programs/P03_ListsOperations.py index 53c5d13..cb16bc8 100644 --- a/Programs/P03_ListsOperations.py +++ b/Programs/P03_ListsOperations.py @@ -46,3 +46,20 @@ #To reverse a list myList.reverse() print('Reversed list:',myList) + +print('After removing \'6\':',myList) + +#To insert an element at a specified Index +myList.insert(5, 6) +print('Inserting \'6\' at 5th index:',myList) + +#To count number of occurences of a element in the list +print('No of Occurences of \'1\':',myList.count(1)) + +#To extend a list that is insert multiple elemets at once at the end of the list +myList.extend([11,0]) +print('Extending list:',myList) + +#To reverse a list +myList.reverse() +print('Reversed list:',myList)