Picking random from dictonary | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Picking random from dictonary

I have a dictonary a={"a":23,"b":27,"c":30,"d":20} and want to pick the numbers whose sum is 50 and print its key and value.

21st Sep 2019, 2:02 AM
𝖆𝖙.𝖚𝕷
𝖆𝖙.𝖚𝕷 - avatar
1 Answer
+ 2
This is pretty similar to this challenge: https://www.sololearn.com/learn/4755/ All you have to do is put all the values in a list, find the subset that sums 50 and get their correspoding keys.
21st Sep 2019, 2:30 AM
Diego
Diego - avatar