In Python For this question, ONLY describe about half a page of the input and half a page of the output of the code below. It must be a very detailed description of the input and output. NO need to code! In your own words, describe the problem including input and output. In your own words, Describe the major steps for solving the problem.   Name and Email Addresses   "Write a program that keeps names and email addresses in a dictionary as key-value pairs. The program should display a menu that lets the user look up a person’s email address, add a new name and email address, change an existing email address, and delete an existing name and email address. The program should save the data stored in a dictionary to a file when the user exits the program. Each time the program starts, it should retrieve the data from the file and store it in a dictionary."

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%

In Python

For this question, ONLY describe about half a page of the input and half a page of the output of the code below. It must be a very detailed description of the input and output.

NO need to code!

  • In your own words, describe the problem including input and output.
  • In your own words, Describe the major steps for solving the problem.

 

Name and Email Addresses

 

"Write a program that keeps names and email addresses in a dictionary as key-value pairs.

The program should display a menu that lets the user look up a person’s email address, add a new name and email address, change an existing email address, and delete an existing name and email address. The program should save the data stored in a dictionary to a file when the user exits the program. Each time the program starts, it should retrieve the data from the file and store it in a dictionary."

ONLY describe the input and the output of the code below. It must be a very detailed description of the input code and output typed below.

Code:

def menu():
print("\nMenu")
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()


def look_email(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 add_new(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 update_mail(m):
name=input("Enter name: ")
email=input("Enter the new address: ")
if name in m:
m[name]=email
print("Information updated")
return m

def delete_record(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")


def main():
data ={}
while True:
menu()
n=int(input("Enter your choice: "))
if n==1:
look_email(data)
elif n==2:
add_new(data)
elif n==3:
update_mail(data)
elif n==4:
delete_record(data)
elif n==5:
print("Information saved")
break

if __name__ == "__main__":
main()

Output:

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
>>>

Upvote for describing in one page the input and output of the program one page. Thank you.

Expert Solution
steps

Step by step

Solved in 3 steps with 7 images

Blurred answer
Knowledge Booster
Binary Search Algorithm
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
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