Very good video thanks. How can we print an extra value such as 'Company' so it prints out the key and then the 2 values. We would need another input I get that. Do we add the values as a list? Thanks
contact = {} def display_contact(): print(contact.items()) print("Name\t\tContact Number") for key in contact: print("{}\t\t{}".format(key,contact.get(key))) while True: choice = int(input(" 1. Add new contact 2. Search contact 3.Display contact 4. Edit contact 5. Delete contact 6.Exit Enter your choice ")) if choice == 1: name = input("enter the contact name ") phone = input("enter the mobile number") contact[name] = phone elif choice == 2: search_name = input("enter the contact name ") if search_name in contact: print(search_name,"'s contact number is ",contact[search_name]) else: print("Name is not found in contact book") elif choice == 3: if not contact: print("empty contact book") else: display_contact() elif choice == 4: edit_contact = input("Enter the contact to be edited ") if edit_contact in contact: phone = input("enter mobile number") contact[edit_contact]=phone print("contact updated") display_contact() else: print("Name is not found in contact book") elif choice == 5: del_contact = input("Enter the contact to be deleted ") if del_contact in contact: confirm = input("Do you want to delete this contact y/n? ") if confirm =='y' or confirm =='Y': contact.pop(del_contact) display_contact() else: print("Name is not found in contact book") else: break
github.com/ChristobelDiana/contact_book
You just a God sent. I got an A thanks to this video
Wow.. thank you 👍
A part of me feels like I don’t accomplish anything if I have to follow along and not do it myself, but I still learn this way too.
how do you feel now? have you learned more?
Great help....Thank u soo much
👍
thanks you very much
👍
Nice,well explained.Congratulations.
Thank you pa
Very good video thanks. How can we print an extra value such as 'Company' so it prints out the key and then the 2 values. We would need another input I get that. Do we add the values as a list? Thanks
Great video, thank you. Now can you show how to save the dictionary to a file so that it persists after the program quits?
Sure, will publish a video on it
th-cam.com/video/JnNBqbMKPS4/w-d-xo.html
Thank u
What we can use instead of format.get function for basic
Thanks for posting
👍
Great video
Thank you
hi a question about the line of code "if not contact" why does it give an error if you would say "if not in contact"?
not in- membership operator: used to test if a variable is present in the sequence
Thank you mum
no problem son
@@Moneyblueprint1 🤣🤣
Thank you for this
👍
How to append the entries in a file.?
thankss
👍
Mam could you please provide documentation for this...
can u add the code some where!?
contact = {}
def display_contact():
print(contact.items())
print("Name\t\tContact Number")
for key in contact:
print("{}\t\t{}".format(key,contact.get(key)))
while True:
choice = int(input(" 1. Add new contact
2. Search contact
3.Display contact
4. Edit contact
5. Delete contact
6.Exit
Enter your choice "))
if choice == 1:
name = input("enter the contact name ")
phone = input("enter the mobile number")
contact[name] = phone
elif choice == 2:
search_name = input("enter the contact name ")
if search_name in contact:
print(search_name,"'s contact number is ",contact[search_name])
else:
print("Name is not found in contact book")
elif choice == 3:
if not contact:
print("empty contact book")
else:
display_contact()
elif choice == 4:
edit_contact = input("Enter the contact to be edited ")
if edit_contact in contact:
phone = input("enter mobile number")
contact[edit_contact]=phone
print("contact updated")
display_contact()
else:
print("Name is not found in contact book")
elif choice == 5:
del_contact = input("Enter the contact to be deleted ")
if del_contact in contact:
confirm = input("Do you want to delete this contact y/n? ")
if confirm =='y' or confirm =='Y':
contact.pop(del_contact)
display_contact()
else:
print("Name is not found in contact book")
else:
break
Error arha h code m
Iska algorithm aur flowchart kaha pr milega