Kamus Python
human = {
"code": "Python",
"name": "John",
"age": 32
}
print(human["age"])
#32 :D
The Cat Coder
human = {
"code": "Python",
"name": "John",
"age": 32
}
print(human["age"])
#32 :D
Polygon = {
"PolygonName" : "Tetrahectaseptadecagon"
"PolygonSides" : 417
}
print("A", (Polygon["PolygonName"]) "has", (Polygon["PolygonSides"]), "sides")
myDict = {
"Fast": "In a Quick Manner",
"Hasya": "A Coder",
"Marks": [1, 2, 5],
"anotherdict": {'hasya': 'Player'}
}
# print(myDict['Fast'])
# print(myDict['Hasya'])
myDict['Marks'] = [45, 78]
print(myDict['Marks'])
print(myDict['anotherdict']['hasya'])
#a dictionary
dict = {
"key": "value",
"other_key": "value"
}
#get a value from the dictionary using the key
print(dict["key"])
#you can also get a value from the dictionary using a normal index:
print(dict[1])
dict1={1:"Tutorials",2:"Point",3:1116}
print("Dictionary 1",dict1)
dict2={1:"TutorialsPoint","TP":"DictionaryTutorial"}
print("Dictionary 2",dict2)
Dict = {"name": 'Izhaan', "salary": 1234, "age": 23}
print("\nDictionary with the use of string Keys: ")
print(Dict)