Note: You must write this program in Python.
General Requirements
The program should display a menu and allow the user to perform one
of the following tasks.
Add an item to the list
Delete an item from the list
Print the list
Print the list in reverse
Quit the program
The program should run until the user chooses to quit. In Python,
programmatically quitting the application is achieved with the
exit() procedure.
You should use a List to store the items the user enters into the
To Do List program
The program should use a combination of these following
constructs
Reading user input
Storing information in variables
Storing information in a list
Conditional (if) statement(s)
Loop(s)
Procedure(s)
Print statements
Notes and Additional Requirements/Functionality NOT Shown in Video
Sample
When you ask the user for an index number you must make sure the
index is valid for the list (greater than or equal to zero and less
than the number of items in the list). When adding an item to the
list you must make sure that the list is not full.
Please note that to get full points for each of the program's
operations (add, delete, print) that you must implement these items
as procedures.
The program should be written in such a way that assumes a list can
hold at least 10 items. For the midterm, many students hard coded
the size of their list to hold only 2 or 3 items. For this program,
assume the minimum size of a list of items will be 10 (this may or
may not effect how you code this in Python, this is only a
guideline).
Extra Credit
Replace Item at Index (10 pts) - Write a menu option that accepts
an index number and overwrites the item at that index with a new
item.
Note: Done accordingly. Please comment for any problem. Please Uprate. Thanks.
Code:
import sys
#show menu and take input
def showMenu():
print("1) Add Item.")
print("2) Delete item.")
print("3) Print list.")
print("4) Print in reverse order.")
print("5) Replace Element.")
print("6) Exit.")
choice=int(input("Choose :"))
return choice
#add item to list
def addItem(list,maximumSize):
if len(list)<maximumSize:
item=input("Please give item :")
list.append(item)
else:
print("List is full")
#delete item
def deleteItem(list):
item=input("Please give item :")
if item in list:
list.remove(item)
else:
print("Item does not exist")
#print list
def printList(list):
for item in list:
print(item+" ",end=' ')
print("\n")
#print in reverse
def printReverse(list):
for i in range(len(list)-1,-1,-1):
print(list[i]+" ",end=' ')
print("\n")
#replace elements
def replaceElement(list):
index=int(input("Please give index :"))
if index<0 or index>=len(list):
print("Invalid Index.")
else:
item=input("Please give value to replace")
list[index]=item
#main function
def main():
list=[]
maximumSize=20
try:
while True:
choice=showMenu()
if choice==1:
addItem(list,maximumSize)
elif choice==2:
deleteItem(list)
elif choice==3:
printList(list)
elif choice==4:
printReverse(list)
elif choice==5:
replaceElement(list)
elif choice==6:
sys.exit()
else:
print("Invalid choice")
except:
print("Program Ended.")
main()
Code Screenshot:



Output:






Note: You must write this program in Python. General Requirements The program should display a menu...
Write a simple todo list application. This will require use of classes, objects, and possibly structs. Here are the requirements: 1. Menu-driven - upon running the program, the user should be prompted to press one of the following: 1. View all Todos in list 2. Remove a todo item from the list * if there are not any todos, the user should be prompted and sent back to the menu * choose a todo from list based on title to...
Write a program in Python that finds the index of an item in a list. For example: You create a of list of colors You find the index of the color "red" Print the list and the index of "red" Your program should work for every item in your list, and it must have at least 3 items in the list. It must also work if you search for an item and it does not exist in the list. You...
Python 3.7 to be used. Just a simple design a program
that depends on its own. You should also not need to import
anything. No code outside of a function!
Median List Traversal and Exception Handling Create a menu-driven program that will accept a collection of non-negative integers from the keyboard, calculate the mean and median values and display those values on the screen. Your menu should have 6 options 50% below 50% above Add a number to the list/array...
Write a Python program (using python 3.7.2) that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows. 1. When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. (Don’t display the...
Python: •Write a program to get the Food Menu using an API •The program should be able to display different food items. If possible, add food prices .
Assignment Write a menu-driven C++ program to manage a class roster of student names that can grow and shrink dynamically. It should work something like this (user input highlighted in blue): Array size: 0, capacity: 2 MENU A Add a student D Delete a student L List all students Q Quit ...your choice: a[ENTER] Enter the student name to add: Jonas-Gunnar Iversen[ENTER] Array size: 1, capacity: 2 MENU A Add a student D Delete a student L List all students...
Write a menu-driven C++ program to manage a class roster of student names that can grow and shrink dynamically. It should work something like this (user input highlighted in blue): Array size: 0, capacity: 2 MENU A Add a student D Delete a student L List all students Q Quit ...your choice: a[ENTER] Enter the student name to add: Jonas-Gunnar Iversen[ENTER] Array size: 1, capacity: 2 MENU A Add a student D Delete a student L List all students Q...
please solve this question:
Write a character Max-Heap Builder program in C++. The program should display the menu below. Each item in the menu should be implemented in a function. a. Add a node. One node to be added to the max-heap. b. Delete a node. One node to be deleted from the max-heap. C. Search a node. Returns true if the node exists in the max-heap, otherwise it returns false. d. Print the tree. Prints the heap in level-order...
Python: I need help with the following quit function ! The quit menu option should not be case sensitive - 'q' or 'Q' should quit the program menu.add_option('Q', 'Quit', quit_program) NB: Remaining code ! """ Program to create and manage a list of books that the user wishes to read, and books that the user has read. """ from bookstore import Book, BookStore from menu import Menu import ui store = BookStore() def main(): menu = create_menu() while True: choice...
Write a program that will maintain a personal phonebook. The program should be menu driven. Create a new phonebook Print the phonebook Add person to the phonebook Remove a person from the phonebook Sort Modify a person Search for a person by name Save to a data file (Can't be done but leave an error message if the user selects) Retreive phonebook from data file (Can't be done but leave an error message if the user selects) Quit Create a...