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:

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education