# Python program to get
# dictionary keys as list
def getList(dict):
list = []
for key in dict.keys():
list.append(key)
return list
# Driver program
dict = {1:'Geeks', 2:'for', 3:'geeks'}
print(getList(dict))
myDict={"name":"PythonForBeginners","acronym":"PFB"}
print("Dictionary is:")
print(myDict)
dict_items=myDict.items()
print("Given value is:")
myValue="PFB"
print(myValue)
print("Associated Key is:")
for key,value in dict_items:
if value==myValue:
print(key)
# Python program to get
# dictionary keys as list
def getList(dict):
list = []
for key in dict.keys():
list.append(key)
return list
# Driver program
dict = {1:'Geeks', 2:'for', 3:'geeks'}
print(getList(dict))
myDict={"name":"PythonForBeginners","acronym":"PFB"}
print("Dictionary is:")
print(myDict)
dict_items=myDict.items()
print("Given value is:")
myValue="PFB"
print(myValue)
print("Associated Key is:")
for key,value in dict_items:
if value==myValue:
print(key)