Starting from:

$30

CSCI161L Assignment 6 -Solved


Create a function menu(),for displaying the following options. 
Option 1: Create and display the dictionary. 
Option 2: Search a value in the dictionary. 
Option 3: Sort the dictionary based on keys. 
Option 4: Display the keys and values of the dictionary as two separate lists. 
Option 5: Exit 
If the user input for the option is 1, then call display(), which will create a dictionary by taking the user 
input items for (key, value) for the dictionary and display it. The keys of the dictionary are integer type 
and the values of the dictionary are strings. 
If the user input for the option is 2, then call search(), which will accept a user input value as string and 
check whether the entered value exists in the dictionary or not. 
If the user input for the option is 3, then call sort(), which sort the dictionary based on the keys in the 
dictionary. 
If the user input for the option is 4, then call lists(), which will get the keys and values from the 
dictionary and display them as two separate lists, where the two lists are sorted. 
If the user input for the option is 5, then exit from the program. 
Only option to exit from the menu is option 5.Sample Output:Instructions: 
• Preferred programming environment: 
o OS 
: Linux (Mint) 
o Interpreter 
: Python 3 (not Python 2) 
o Editor 
: gedit or editor of your choice 
• The program is saved as a file with .py extension. 
• The program should include a comment block at the top with your name, course number and 
course section, assignment number 
For example: 
# Your name 
# CSCI II 161 L01/L02 
# Assignment 6 
• Upload your file as your lastname_firstname_assignmentnumber.pyFor example: 
lastname_firstname_6.py

More products