Question: Python Assignment: You will be using your code from programming assignment 4 to write a program that add, edit, delete, and search persons information from

Python Assignment:

You will be using your code from programming assignment 4 to write a program that add, edit, delete, and search persons information from Python dictionary.

Assignment requirement:

The program should prompt people to enter personal information and store the information in python dictionary. Your programming assignment four enables you to register three people. You will be modifying this program to register 10 people. Other requirements for this assignment

Storing the persons information in dictionary.

Using personID, as a key to store personal information including the address of each person.

Using perosnID, to search and display personal information related to the key.

Using personID, to remove/delete persons record from the dictionary.

Using personID, to update existing information of the registered person.

This program begins by asking the user for what they want to do:

For example, the interaction with the program will look like the following.

If the user types, search and press the enter key, the program will prompt/ask the user to enter, personID. Assume that the personID for that person is person1

When the user enters person1 and press the enter key, information of the person1 will display on the screen.

If the user types, add and press the enter key, the program will prompt/ask the user to enter, personID. Assume that the personID for that person is person2

When the user enters person2 and press the enter key, the user will be asked to add personal and address information of the person with person2 id

Code:

personalInfo1 = [] personalInfo2 = [] personalInfo3 = []

addressInfo1 = [] addressInfo2 = [] addressInfo3 = [] def getPersonalInfo(i,): if i == 1: return personalInfo1

if i == 2: return personalInfo2

if i == 3: return personalInfo3

def getAddressInfo(i,personalID): if i == 1: return addressInfo1 if i == 2: return addressInfo2 if i == 3: return addressInfo3

def main(): for i in [1, 2, 3]: if i == 1: personalInfo1.append(input('Enter first name of the first person:')) personalInfo1.append(input('Enter the last name of the first person:')) personalInfo1.append(input('Enter the age of the first person:')) personalInfo1.append(input('Enter height of the first person:')) addressInfo1.append(input('Enter street address of the first person:')) addressInfo1.append(input('Enter City of the first person:')) addressInfo1.append(input('Enter State of the first person:')) addressInfo1.append(input('Enter Zip code of the first person:')) print(' ') if i == 2: personalInfo2.append(input(' Enter first name of the second person:')) personalInfo2.append(input('Enter the last name of the second person:')) personalInfo2.append(input('Enter the age of the second person:')) personalInfo2.append(input('Enter height of the second person:')) addressInfo2.append(input('Enter street address of the second person:')) addressInfo2.append(input('Enter City of the second person:')) addressInfo2.append(input('Enter State of the second person:')) addressInfo2.append(input('Enter Zip code of the second person:')) print(' ') if i == 3: personalInfo3.append(input(' Enter first name of the third person:')) personalInfo3.append(input('Enter the last name of the third person:')) personalInfo3.append(input('Enter the age of the third person:')) personalInfo3.append(input('Enter height of the third person:')) addressInfo3.append(input('Enter street address of the third person:')) addressInfo3.append(input('Enter City of the third person:')) addressInfo3.append(input('Enter State of the third person:')) addressInfo3.append(input('Enter Zip code of the third person:')) #Process print(' ') for i in [1, 2, 3]: #Using functions to get data personalInfo = getPersonalInfo(i) addressInfo = getAddressInfo(i) if i == 1: print("First Person's information") print('\t\tFirst Name:', personalInfo[0]) print('\t\tLast Name:', personalInfo[1]) print('\t\tAge:', personalInfo[2]) print('\t\tHeight:', personalInfo[3]) print('\t\tStreet Address:', addressInfo[0]) print('\t\tCity:', addressInfo[1]) print('\t\tState:', addressInfo[2]) print('\t\tZip code:', addressInfo[3])

if i == 2: print(" Second Person's information") print('\t\tFirst Name:', personalInfo[0]) print('\t\tLast Name:', personalInfo[1]) print('\t\tAge:', personalInfo[2]) print('\t\tHeight:', personalInfo[3]) print('\t\tStreet Address:', addressInfo[0]) print('\t\tCity:', addressInfo[1]) print('\t\tState:', addressInfo[2]) print('\t\tZip code:', addressInfo[3])

if i == 3: print(" Third Person's information") print('\t\tFirst Name:', personalInfo[0]) print('\t\tLast Name:', personalInfo[1]) print('\t\tAge:', personalInfo[2]) print('\t\tHeight:', personalInfo[3]) print('\t\tStreet Address:', addressInfo[0]) print('\t\tCity:', addressInfo[1]) print('\t\tState:', addressInfo[2]) print('\t\tZip code:', addressInfo[3]) main()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!