I'm trying to return a default value of r if r does not exist as a key in the hm dictionary. so casting as an int should only occur when r does not exist as a key. yet, it looks like casting is attempted unconditionally. how do I fix the code to represent what I'm trying to do? I could use a ternary but I thought the whole point of the default value field of the dictionary is to be used the way I'm using it below.
hm = {'A': 14, 'K': 13}
r = [hm.get(r, int(r)) for r, _ in ['AC', '3D', 'KH', '4S']]