Python's built-in dictionary class has keys() method which returns list of all key components in each key-value pair. The built-in function max() gives highest key from the list
>>> dct={1:45,2:76,3:12,4:55,5:33} >>> klist=dct.keys() >>> klist dict_keys([1, 2, 3, 4, 5]) >>> max(klist) 5