Random Python dictionary key, weighted by values September 18, 2023 by Tarik This would work: random.choice([k for k in d for x in d[k]])