NO IMPORT PICKLE Please check the picture and add one more function(def) and fix the error in the code. Write a program that keeps names and email addresses in a dictionary as key-value pairs. You Must create and use at least 5 meaningful functions. A function to display a menu A function to look up a person’s email address A function to add a new name and email address A function to change an email address A function to delete a name and email address.   This is the Required Output example:   Menu ---------------------------------------- 1. Look up an email address 2. Add a new name and email address 3. Change an existing email address 4. Delete a name and email address 5. Quit the program   Enter your choice: 2 Enter name: John Enter email address: John@yahoo.com That name already exists   Menu ---------------------------------------- 1. Look up an email address 2. Add a new name and email address 3. Change an existing email address 4. Delete a name and email address 5. Quit the program   Enter your choice: 2 Enter name: Jack Enter email address: Jack@yahoo.com Name and address have been added   Menu ---------------------------------------- 1. Look up an email address 2. Add a new name and email address 3. Change an existing email address 4. Delete a name and email address 5. Quit the program   Enter your choice: 1 Enter a name: Sam The specified name was not found   Menu ---------------------------------------- 1. Look up an email address 2. Add a new name and email address 3. Change an existing email address 4. Delete a name and email address 5. Quit the program   Enter your choice: 1 Enter a name: Jack Name: Jack Email: Jack@yahoo.com   Menu ---------------------------------------- 1. Look up an email address 2. Add a new name and email address 3. Change an existing email address 4. Delete a name and email address 5. Quit the program   Enter your choice: 3 Enter name: John Enter the new address: John@wayne.edu Information updated   Menu ---------------------------------------- 1. Look up an email address 2. Add a new name and email address 3. Change an existing email address 4. Delete a name and email address 5. Quit the program   Enter your choice: 1 Enter a name: John Name: John Email: John@wayne.edu   Menu ---------------------------------------- 1. Look up an email address 2. Add a new name and email address 3. Change an existing email address 4. Delete a name and email address 5. Quit the program   Enter your choice: 4 Enter name: Sam The specified name was not found   Menu ---------------------------------------- 1. Look up an email address 2. Add a new name and email address 3. Change an existing email address 4. Delete a name and email address 5. Quit the program   Enter your choice: 4 Enter name: Jack Information deleted   Menu ---------------------------------------- 1. Look up an email address 2. Add a new name and email address 3. Change an existing email address 4. Delete a name and email address 5. Quit the program   Enter your choice: 1 Enter a name: Jack The specified name was not found   Menu ---------------------------------------- 1. Look up an email address 2. Add a new name and email address 3. Change an existing email address 4. Delete a name and email address 5. Quit the program   Enter your choice: 5 Information saved >>>  Please check the pictures and fix the code. Upvote for following the required steps and working code. Thank You. Working code it, but it needs one more function as mention in the directions and it gives an error. Check the picture please. def func1(m): name=input("Enter a name:") if name in m: print("Name: ",name) print("Email: ",m[name]) else: print("The specified name was not found") def func2(m): name=input("Enter name: ") email=input("Enter email address: ") if name in m: print("That name already exists") else: m[name]=email print("Name and address have been added") return m def func3(m): name=input("Enter name: ") email=input("Enter the new address: ") if name in m: m[name]=email print("Information updated") return m def func4(m): name=input("Enter name: ") if name in m: del m[name] print("Information deleted") return m else: print("The specified name was not found") menu={} flag=True while(flag): print("Menu") print("----------------------------------------") print("1. Look up an email address") print("2. Add a new name and email address") print("3. Change an existing email address") print("4. Delete a name and email address") print("5. Quit the program") print() n=int(input("Enter your choice: ")) if(n==1): func1(menu) elif(n==2): menu=func2(menu) elif(n==3): menu=func3(menu) elif(n==4): menu=func4(menu) elif(n==5): print("Information saved") flag=False   Upvote for adding one more function ''def'' and fixing the error from the already existing code. ERROR: Traceback (most recent call last): File "C:/Users/17737/OneDrive/Desktop/Projectttt.py", line 52, in menu=func2(menu) File "C:/Users/17737/OneDrive/Desktop/Projectttt.py", line 12, in func2 if name in m: TypeError: argument of type 'NoneType' is not iterable >>> TypeError: argument of type 'NoneType' is not iterable SyntaxError: invalid syntax

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter14: Files And Streams
Section: Chapter Questions
Problem 2E: Create a program named FileComparison that compares two files. First, use a text editor such as...
icon
Related questions
Question
100%

Python 3

NO IMPORT PICKLE

Please check the picture and add one more function(def) and fix the error in the code.

Write a program that keeps names and email addresses in a dictionary as key-value pairs. You Must create and use at least 5 meaningful functions.

  • A function to display a menu
  • A function to look up a person’s email address
  • A function to add a new name and email address
  • A function to change an email address
  • A function to delete a name and email address.

 

This is the Required Output example:

 

Menu

----------------------------------------

1. Look up an email address

2. Add a new name and email address

3. Change an existing email address

4. Delete a name and email address

5. Quit the program

 

Enter your choice: 2

Enter name: John

Enter email address: John@yahoo.com

That name already exists

 

Menu

----------------------------------------

1. Look up an email address

2. Add a new name and email address

3. Change an existing email address

4. Delete a name and email address

5. Quit the program

 

Enter your choice: 2

Enter name: Jack

Enter email address: Jack@yahoo.com

Name and address have been added

 

Menu

----------------------------------------

1. Look up an email address

2. Add a new name and email address

3. Change an existing email address

4. Delete a name and email address

5. Quit the program

 

Enter your choice: 1

Enter a name: Sam

The specified name was not found

 

Menu

----------------------------------------

1. Look up an email address

2. Add a new name and email address

3. Change an existing email address

4. Delete a name and email address

5. Quit the program

 

Enter your choice: 1

Enter a name: Jack

Name: Jack

Email: Jack@yahoo.com

 

Menu

----------------------------------------

1. Look up an email address

2. Add a new name and email address

3. Change an existing email address

4. Delete a name and email address

5. Quit the program

 

Enter your choice: 3

Enter name: John

Enter the new address: John@wayne.edu

Information updated

 

Menu

----------------------------------------

1. Look up an email address

2. Add a new name and email address

3. Change an existing email address

4. Delete a name and email address

5. Quit the program

 

Enter your choice: 1

Enter a name: John

Name: John

Email: John@wayne.edu

 

Menu

----------------------------------------

1. Look up an email address

2. Add a new name and email address

3. Change an existing email address

4. Delete a name and email address

5. Quit the program

 

Enter your choice: 4

Enter name: Sam

The specified name was not found

 

Menu

----------------------------------------

1. Look up an email address

2. Add a new name and email address

3. Change an existing email address

4. Delete a name and email address

5. Quit the program

 

Enter your choice: 4

Enter name: Jack

Information deleted

 

Menu

----------------------------------------

1. Look up an email address

2. Add a new name and email address

3. Change an existing email address

4. Delete a name and email address

5. Quit the program

 

Enter your choice: 1

Enter a name: Jack

The specified name was not found

 

Menu

----------------------------------------

1. Look up an email address

2. Add a new name and email address

3. Change an existing email address

4. Delete a name and email address

5. Quit the program

 

Enter your choice: 5

Information saved

>>> 

Please check the pictures and fix the code.

Upvote for following the required steps and working code. Thank You.

Working code it, but it needs one more function as mention in the directions and it gives an error. Check the picture please.

def func1(m):
name=input("Enter a name:")
if name in m:
print("Name: ",name)
print("Email: ",m[name])
else:
print("The specified name was not found")

def func2(m):
name=input("Enter name: ")
email=input("Enter email address: ")
if name in m:
print("That name already exists")
else:
m[name]=email
print("Name and address have been added")
return m

def func3(m):
name=input("Enter name: ")
email=input("Enter the new address: ")
if name in m:
m[name]=email
print("Information updated")
return m

def func4(m):
name=input("Enter name: ")
if name in m:
del m[name]
print("Information deleted")
return m
else:
print("The specified name was not found")


menu={}
flag=True
while(flag):
print("Menu")
print("----------------------------------------")
print("1. Look up an email address")
print("2. Add a new name and email address")
print("3. Change an existing email address")
print("4. Delete a name and email address")
print("5. Quit the program")
print()
n=int(input("Enter your choice: "))
if(n==1):
func1(menu)
elif(n==2):
menu=func2(menu)
elif(n==3):
menu=func3(menu)
elif(n==4):
menu=func4(menu)
elif(n==5):
print("Information saved")
flag=False

 

Upvote for adding one more function ''def'' and fixing the error from the already existing code.

ERROR:

Traceback (most recent call last):
File "C:/Users/17737/OneDrive/Desktop/Projectttt.py", line 52, in <module>
menu=func2(menu)
File "C:/Users/17737/OneDrive/Desktop/Projectttt.py", line 12, in func2
if name in m:
TypeError: argument of type 'NoneType' is not iterable
>>> TypeError: argument of type 'NoneType' is not iterable
SyntaxError: invalid syntax
>>>

BE1600 - Project -
*Python 3.8.4 Shell*
ff
File Edit Shell Debug Options Window Help
Refere
4. Delete a name and email address
me
Insert
Design
Layout
write the data in the dictionary in a file 5. Quit the program
Enter your choice: 2
Enter name: John
This is the Required Output example:
Enter email address: John@yhaoo.com
Name and address have been added
Menu
Menu
1. Look up an email address
2. Add a new name and email address
3. Change an existing email address
4. Delete a name and email address
5. Quit the program
1. Look up an email address
2. Add a new name and email address
3. Change an existing email address
4. Delete a name and email address
5. Quit the program
Enter your choice: 2
Enter name: John
Enter your choice: 2
Enter name: John
Enter email address: John@yhaoo.com
That name already exists
Enter email address: John@yahoo.com
That name already exists
Menu
1. Look up an email address
2. Add a new name and email address
3. Change an existing email address
4. Delete a name and email address
5. Quit the program
Menu
1. Look up an email address
2. Add a new name and email address
3. Change an existing email address
4. Delete a name and email address
5. Quit the program
Enter your choice: 2
Enter name:
Jack
Enter email address: Jack@yhaoo.com
Traceback (most recent call last) :
File "C:/Users/17737/OneDrive/Desktop/Projectttt.py", line 52, in <module>
menu=func2 (menu)
File "C:/Users/17737/OneDrive/Desktop/Projectttt.py", line 12, in func2
if name in m:
Enter your choice: 2
Enter name: Jack
Enter email address: Jack@yahoo.com
Name and address have been added
Menu
TypeError: argument of type 'NoneType' is not iterable
>>> TypeError: argument of type 'NoneType' is not iterable
SyntaxError: invalid syntax
1. Look up an email address
>>>
2. Add a new name and email address
>>>
3. Change an existing email address
>>>
>>> Do not modify the code just add another function def and fix the error. Upvote for working code.
Transcribed Image Text:BE1600 - Project - *Python 3.8.4 Shell* ff File Edit Shell Debug Options Window Help Refere 4. Delete a name and email address me Insert Design Layout write the data in the dictionary in a file 5. Quit the program Enter your choice: 2 Enter name: John This is the Required Output example: Enter email address: John@yhaoo.com Name and address have been added Menu Menu 1. Look up an email address 2. Add a new name and email address 3. Change an existing email address 4. Delete a name and email address 5. Quit the program 1. Look up an email address 2. Add a new name and email address 3. Change an existing email address 4. Delete a name and email address 5. Quit the program Enter your choice: 2 Enter name: John Enter your choice: 2 Enter name: John Enter email address: John@yhaoo.com That name already exists Enter email address: John@yahoo.com That name already exists Menu 1. Look up an email address 2. Add a new name and email address 3. Change an existing email address 4. Delete a name and email address 5. Quit the program Menu 1. Look up an email address 2. Add a new name and email address 3. Change an existing email address 4. Delete a name and email address 5. Quit the program Enter your choice: 2 Enter name: Jack Enter email address: Jack@yhaoo.com Traceback (most recent call last) : File "C:/Users/17737/OneDrive/Desktop/Projectttt.py", line 52, in <module> menu=func2 (menu) File "C:/Users/17737/OneDrive/Desktop/Projectttt.py", line 12, in func2 if name in m: Enter your choice: 2 Enter name: Jack Enter email address: Jack@yahoo.com Name and address have been added Menu TypeError: argument of type 'NoneType' is not iterable >>> TypeError: argument of type 'NoneType' is not iterable SyntaxError: invalid syntax 1. Look up an email address >>> 2. Add a new name and email address >>> 3. Change an existing email address >>> >>> Do not modify the code just add another function def and fix the error. Upvote for working code.
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Dictionary
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
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,