Question

Write a code using python to make an Agenda that can store values such as Name,...

Write a code using python to make an Agenda that can store values such as Name, Address and Phone number of 10 digits

Name format First, Last

Address Format Street, Number Zip City ST. Country

phone format (###) ###-####

This program should give the option of adding a new contact or Display all the contacts you have stored by typing New Contact or Display Contacts

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code:

def new_contact(): #difining the new function to add the contact
name = input("Enter Name of Contact: ") #taking necessary inputs....
address = input("Enter the Address of Contact: ")
phone = input("Enter the Phone Number: ")
mycontact = {'Name':name, 'Address':address, 'Phone Number':phone} #store all the inputs into a dictationary datatype
print("Contact sucessfully added")
return mycontact #it will return the dictationary of contact.

contacts_list=[] #this will store all the contacts
while True: #infinite loop
action=input("Type New Contact or Display Contacts or 'Exit' to exit the program ")
if action=='New Contact': #conditions
contacts_list.append(new_contact()) #here I call the function which return the dict of contact
if action=='Display Contacts': #condition to display the contact....
print(contacts_list)
if action=='Exit': # condition to break the loop
break

ScreenShot:

Output of program is given below the cell.

You can also use nested dict to store the contacts.

If you have further doubts let me know in comments.

Please Like my Efforts.

Thank You.

Add a comment
Know the answer?
Add Answer to:
Write a code using python to make an Agenda that can store values such as Name,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • a. Define the struct node that can store a name and up to 3 phone numbers...

    a. Define the struct node that can store a name and up to 3 phone numbers (use an array for the phone numbers). The node struct will also store the address to the next node. b. Define a class contactList that will define a variable to keep track of the number of contacts in the list, a pointer to the first and last node of the list. c. Add the following methods to the class: i. Add a new contact....

  • Write the code to maintain a list of student records. The main flow of your program...

    Write the code to maintain a list of student records. The main flow of your program should be to read all information from file(s) and place it in arrays, loop and do stuff with the records (e.g., add, update, look up, etc.), before exiting optionally write the new information back to the file(s) before exiting. Please note the files are only accessed at the beginning and the end, do not change the files during the "do stuff loop" (unless you...

  • Your task for this project is to write a parser for a customer form. You need to develop a Java a...

       Your task for this project is to write a parser for a customer form. You need to develop a Java application using Parboiled library. Your program should include a grammar for the parser and display the parse tree with no errors. Remember that your fifth and sixth assignments are very similar to this project and you can benefit from them. The customer form should include the following structure: First name, middle name (optional), last name Street address, city, state (or...

  • C++: Array of contact info Design a contact struct, that takes your phone struct and address...

    C++: Array of contact info Design a contact struct, that takes your phone struct and address struct along with a c string for a name to create a record of contact information. ( C++: Design a Struct Design two structs address and phone Address has the following attributes: street address, city name, state code, zip code. phone has 3 numbers: area code, prefix and suffix test these by writing a program that creates one of each and fills them with...

  • Write a java project that reads a sequence of up to 25 pairs of names and...

    Write a java project that reads a sequence of up to 25 pairs of names and postal (ZIP) codes, street address, city, state, and 10-digit phone number for individuals. Store the data in an object designed to store a first name (string), last name (string), and postal code (integer), street address (string), city( string), state (string), and 10-digit phone number (long integer, contains area code and does not include special characters such as '(', ')', or '-' . Assume each...

  • In python create a TaxReturn class with attributes that hold a taxpayer's Social Security number, last...

    In python create a TaxReturn class with attributes that hold a taxpayer's Social Security number, last name, first name, street address, city, state, zip code, annual income, marital status, and tax liability. Include a constructor that requires arguments that provide values for all the fields other than the tax liability. The constructor calculates the tax liability based on annual income and the percentages in the following table: Income($) Single Married 0 - 20,000 15% 14% 20,001 - 50,000 22% 20%...

  • language:python VELYIEW Design a program that you can use to keep information on your family or...

    language:python VELYIEW Design a program that you can use to keep information on your family or friends. You may view the video demonstration of the program located in this module to see how the program should function. Instructions Your program should have the following classes: Base Class - Contact (First Name, Last Name, and Phone Number) Sub Class - Family (First Name, Last Name, Phone Number, and Relationship le. cousin, uncle, aunt, etc.) Sub Class - Friends (First Name, Last...

  • Write a program that uses a structure to store the following data about a customer account: Name Address City, sta...

    Write a program that uses a structure to store the following data about a customer account: Name Address City, state, and ZIP Telephone number Account Balance Date of last payment The program should use an vector of at least 20 structures. It should let the user enter data into the vector, change the contents of any element, and display all the data stored in the array. The program should have a menu-driven user interface. Input Validation: When the data for...

  • Write a program that uses a class or structure to store the following data about a...

    Write a program that uses a class or structure to store the following data about a customer account. Name Address City, State and Zip Telephone Number Account Balance Date of Last Payment The program should use an array or vector of 10 objects. It should let the users enter data, change the contents of any element and display all the data stored in the array or vector. The program should be modular and menu driven. Validation: When the data for...

  • In the Python interpreter window (aka IDLE), create five variables: street, number, city, state, zip. street...

    In the Python interpreter window (aka IDLE), create five variables: street, number, city, state, zip. street will hold your street name, number will hold your house number, city will hold your city, state will hold your state, and zipcode will hold your zip code. Print your address in the standard format for mailing addresses. Your print statements will utilize the variable names. Take a screenshot of the IDLE window. It should show your assignment of values to the variables, your...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT