Use tuple as key : Dictionary Tuple « Dictionary « Python






Use tuple as key

Use tuple as key
Matrix = {}

Matrix[(2,3,4)] = 88

Matrix[(7,8,9)] = 99

X = 2; Y = 3; Z = 4              # ; separates statements
print Matrix[(X,Y,Z)]

print Matrix



           
       








Related examples in the same category

1.Define tuple as key in a dictionaryDefine tuple as key in a dictionary
2.Dictionary exists fetch and non-exist fetchDictionary exists fetch and non-exist fetch