add a value to the Dictionary

Issue

hi first of all I’m making a number book so give me your suggestions my code

seconde I want to make the user able to add a number and a name to the dictionary
the code

Solution

contact = {}
contactn = {}

m = input("do you want to add new contact ?")

if m == "no" :
    print("ok")
elif m == "yes":
    new_number = input("enter the number")
    new_name = input("enter the name")

    contact[new_name] = new_number
    contactn[new_number] = new_name

Answered By – Vijay Benz

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published