Python dictionary

technical talkiess
0

 print("Dictionary is the key or value pair")

d1 = {"vishal":"usrate","tata":"ratan","asdasd":"asdasd","youtube":"video"}
# if you want ot access the some key value then you access the following
# print(d1['vishal'])

# if you want to add some some value in the dicionary 

d1['add_extra'] = 'add extra parameter'

# print(d1)

# if you want to the delete some key or value pair in the list then you can delete like following

# del d1["add_extra"]
# print(d1)
# if you want to the copy dictionary in the new variable then you can use the following code ... use this
# d2 = d1.copy()
# print(d2)

# if you want to the copy the dictionary but you can use following code ..... its wrong .... its delete the both the dictionary entry so please do't use this 
# d3 = d1
# del d3['add_extra']
# print(d1)



# excercise 

word_dictionary = {"lay":"adva sleep","do":"karne","wake":"jagi hone","walk":"chalne"}
print("Enter the word which you want to meaning ")

iput = input()

print(word_dictionary[iput])
Tags

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)