IMPORTANT: you need to complete the PDP thinking process your program. Turn in item: 1) one complete PDP for the program. 2) directory_file.py – this program allows users to contribute to and view a text file containing usernames and emails • Use our menu-based program model – you can adapt the ch5_dictionary_starter.py in D2L resources – but this time we use a file, not a dictionary, for the data source! • The user has three options – view, add and exit – delete un-needed code, and adapt a function for each menu choice At the start of the program, create your .txt file in 'w' mode, with one sample entry (see 1st view output below) OFF User can choose to add to the text file by inputting a username and email. The input string can include multiple contacts, by using a comma to separate each contact's info from the next. User can also simply choose to read names, COOGD MEN Tia - Vie uenana/anasi fila add - Add anana (a)/nail (a) to the fila Rit - Et peogan and email addresses from the txt file. Notes: initially create the file in 'w write mode, Comnand: rie as nickayaousagmail.com add to the file in 'a' (append) mode Comnand: add and view the file in 'r' mode Tou hars chosan to add uaenanaa s anasla to th disactosy- Use thia foemat... aaenane agaddesas.con, aaanane anaiigaddeaaa.com (Saparata ach ne contat'a antsy wsth a comma.) uck donaldduckagmail.com.cune oadeunnargmail.com Comnandsviar Ensure that it's user-friendly. mouae mickaymouaatgnaii.com ddack donaidduckegnas1.com nas oadeutnagnai.com www Command:

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter11: Sql Server Databases
Section: Chapter Questions
Problem 4E
icon
Related questions
Question
100%

python

 

PC File Edit View Navigate Code Refactor Run Iools VCS Window Help
lab5_dictionary_starter.py - lab5_dictionary_starter.py
A lab5_dictionary_starter.py
Add Configuration.
A lab5_dictionary_starter.py
7
def main():
A 11 A v
8
try:
9
countries = {'CA': 'Canada', 'US': 'United States', 'MX': 'Mexico'}
10
display_menu (O
while True:
11
12
command = input('Command: ')
13
command = command.lower()
14
if command == 'view':
15
view(countries)
16
elif command == 'add':
17
add (countries)
18
elif command == 'del':
19
delete(countries)
20
elif command == 'exit':
21
print('Bye!')
22
break
23
else:
24
print('Not a valid command. Please try again. \n')
25
except KeyError:
26
print('Key Error ')
27
def display_menu():
28
print('COMMAND MENU')
29
print('view - View country name')
30
print('add - Add a country')
31
print('del - Delete a country')
32
print('exit - Exit program')
33
print()
dof vinuloount+ninc).
add0 > else
2 Python Console
O Python 3.8 has been configured as the project interpreter // Configure a Python Interpreter.. (5 minutes ago)
E TODO
e 6: Problems
2 Terminal
O Event Log
54:48 CRLF UTF-8 4 spaces Python 3.8 1
+ 2: Favorites
1. 1: Structure
Transcribed Image Text:PC File Edit View Navigate Code Refactor Run Iools VCS Window Help lab5_dictionary_starter.py - lab5_dictionary_starter.py A lab5_dictionary_starter.py Add Configuration. A lab5_dictionary_starter.py 7 def main(): A 11 A v 8 try: 9 countries = {'CA': 'Canada', 'US': 'United States', 'MX': 'Mexico'} 10 display_menu (O while True: 11 12 command = input('Command: ') 13 command = command.lower() 14 if command == 'view': 15 view(countries) 16 elif command == 'add': 17 add (countries) 18 elif command == 'del': 19 delete(countries) 20 elif command == 'exit': 21 print('Bye!') 22 break 23 else: 24 print('Not a valid command. Please try again. \n') 25 except KeyError: 26 print('Key Error ') 27 def display_menu(): 28 print('COMMAND MENU') 29 print('view - View country name') 30 print('add - Add a country') 31 print('del - Delete a country') 32 print('exit - Exit program') 33 print() dof vinuloount+ninc). add0 > else 2 Python Console O Python 3.8 has been configured as the project interpreter // Configure a Python Interpreter.. (5 minutes ago) E TODO e 6: Problems 2 Terminal O Event Log 54:48 CRLF UTF-8 4 spaces Python 3.8 1 + 2: Favorites 1. 1: Structure
LAB ASSIGNMENTS
IMPORTANT: you need to complete the PDP thinking process your program. Turn in item:
1) one complete PDP for the program.
2) directory_file.py – this program allows users to contribute to and view a text file containing usernames and emails
Use our menu-based program model – you can adapt the ch5_dictionary_starter.py in D2L resources – but
this time we use a file, not a dictionary, for the data source!
The user has three options - view, add and exit – delete un-needed code, and adapt a function for each menu choice
At the start of the program, create your .txt file in 'w' mode, with one sample entry (see 1* view output below)
User can choose to add to the text file by inputting a username and email. The input string can include multiple
contacts, by using a comma to separate each contact's info from the next.
User can also simply choose to read names
rier - Vier saenana//anail fila
add - Add aenana (a)/email (a) to the fila
Reit - Exit peogran
and email addresses from the .txt file.
Notes: initially create the file in 'w' write mode, Connand: vier
mouas nickayaousetgnasi.can
add to the file in 'a' (append) mode
Comand: add
Tou have chosan to add uaeenanaa s anaila to the disectosy-
and view the file in 'r' mode
Dse this foenat...
saaznane anaisaddesas.con.saeznane enai1gaddeeaa.com
(Sapazata ach ne contaet'a antzy with a comna.) uck donaldduckgmail.com.sanes adrunnargmail.com
Command: viar
Ensure that it's user-friendly.
oas nicksyaousagmail.com
ddack donaidduckegnasi.com
nes oadrunnagnaili.com
200000
Conmand:
=Notes
88
豆 --
Transcribed Image Text:LAB ASSIGNMENTS IMPORTANT: you need to complete the PDP thinking process your program. Turn in item: 1) one complete PDP for the program. 2) directory_file.py – this program allows users to contribute to and view a text file containing usernames and emails Use our menu-based program model – you can adapt the ch5_dictionary_starter.py in D2L resources – but this time we use a file, not a dictionary, for the data source! The user has three options - view, add and exit – delete un-needed code, and adapt a function for each menu choice At the start of the program, create your .txt file in 'w' mode, with one sample entry (see 1* view output below) User can choose to add to the text file by inputting a username and email. The input string can include multiple contacts, by using a comma to separate each contact's info from the next. User can also simply choose to read names rier - Vier saenana//anail fila add - Add aenana (a)/email (a) to the fila Reit - Exit peogran and email addresses from the .txt file. Notes: initially create the file in 'w' write mode, Connand: vier mouas nickayaousetgnasi.can add to the file in 'a' (append) mode Comand: add Tou have chosan to add uaeenanaa s anaila to the disectosy- and view the file in 'r' mode Dse this foenat... saaznane anaisaddesas.con.saeznane enai1gaddeeaa.com (Sapazata ach ne contaet'a antzy with a comna.) uck donaldduckgmail.com.sanes adrunnargmail.com Command: viar Ensure that it's user-friendly. oas nicksyaousagmail.com ddack donaidduckegnasi.com nes oadrunnagnaili.com 200000 Conmand: =Notes 88 豆 --
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Introduction to computer system
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L