The document is a Computer Science project by Ansh Pandey from PM SHRI Kendriya Vidyalaya, focusing on a menu-driven Python program. It includes sections such as a certificate of completion, acknowledgments, and the program code that allows various list operations. The project demonstrates practical applications of Python programming in managing list data structures.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
18 views11 pages
CS Project
The document is a Computer Science project by Ansh Pandey from PM SHRI Kendriya Vidyalaya, focusing on a menu-driven Python program. It includes sections such as a certificate of completion, acknowledgments, and the program code that allows various list operations. The project demonstrates practical applications of Python programming in managing list data structures.
class XI ‘G’ has satisfactorily completed his Computer Science on the topic MENU DRIVEN PYTHON PROGRAM as prescribed by the CBSE during the academic year 2024-2025. ACKNOWLEDGEMENT I would like to express my immense gratitude to my chemistry teacher Mr. DEVINDER SIR for the help and guidance he provided for completing this project.
I also thank my parents who gave their
ideas and inputs in making this project. Most of all I thank our school management, for providing us the facilities and opportunity to do this project.
Lastly, I would like to thanks my classmates
who have done this project along with me. Their support made this project fruitful.
ANSH PANDEY 11thG
PROGRAM myList = [] #myList already has 5 elements choice = 0 while True: print("The list 'myList' has the following elements", myList) print("\nL I S T O P E R A T I O N S") print(" 1. Append an element") print(" 2. Insert an element at the desired position") print(" 3. Append a list to the given list") print(" 4. Modify an existing element") print(" 5. Delete an existing element by its position") print(" 6. Delete an existing element by its value") print(" 7. Sort the list in ascending order") print(" 8. Sort the list in descending order") print(" 9. Display the list") print(" 10. Exit") choice = int(input("ENTER YOUR CHOICE (1-10): ")) if choice == 1: element = int(input("Enter the element to be appended: ")) myList.append(element) print("The element has been appended\n") elif choice == 2: element = int(input("Enter the element to be inserted: ")) pos = int(input("Enter the position:")) myList.insert(pos,element) print("The element has been inserted\n") elif choice == 3: newList = eval(input( "Enter the elements separated by commas")) myList.extend(list(newList)) print("The list has been appended\n") elif choice == 4: i = int(input("Enter the position of the element to be modified: ")) if i < len(myList): newElement = int(input("Enter the new element: ")) oldElement = myList[i] myList[i] = newElement print("The element",oldElement,"has been modified\n") else: print("Position of the element is more than the length of list") elif choice == 5: i = int(input("Enter the position of the element to be deleted: ")) if i < len(myList): element = myList.pop(i) print("The element",element,"has been deleted\n") else: print("\nPosition of the element is more than the length of list") elif choice == 6: element = int(input("\nEnter the element to be deleted: ")) if element in myList: myList.remove(element) print("\nThe element",element,"has been deleted\n") else: print("\nElement",element,"is not present in the list") elif choice == 7: myList.sort() print("\nThe list has been sorted") elif choice == 8: myList.sort(reverse = True) print("\nThe list has been sorted in reverse order") elif choice == 9: print("\nThe list is:", myList) elif choice == 10: break else: print("Choice is not valid") print("\n\nPress any key to continue..............") ch = input() OUTPUT