Question: Have a scramble game that I want to delete the original message if it was solved or not solved. Tried client.delete\_message(nameofmsghere) but it's not deleting it.

```
if message.content.startswith('!scramble'):
    async with aiohttp.post("http://watchout4snakes.com/wo4snakes/Random/RandomWord") as post:
        assert isinstance(post, aiohttp.ClientResponse)
        word = await post.read()
    word = word.decode()
    print(word)
    scrambled = random.sample(word, len(word))
    scrambled = ''.join(scrambled)
    scramblemsg = "The word scramble is: `{}`! You have 10 seconds to solve...".format(scrambled)
    await client.send_message(message.channel, scramblemsg)
def check(m):
    return m.content == word
scrambleloot = random.randint(5,15)
msg = await client.wait_for_message(timeout= 10, check=check)
try:
    if msg:
        await client.send_message(message.channel, "Nice job! {} solved the scramble for ${}! The word was {}!".format(msg.author.mention, scrambleloot, word))
        await client.delete_message(scramblemsg)
        add_dollars(msg.author, scrambleloot)
    else:
        if msg is None:
            await client.send_message(message.channel, "Oops! Nobody solved it. The word was {}!".format(word))
            await client.delete_message(scramblemsg)

```

Answer: 
You can use a dictionary comprehension:

```
demo1={'1':['a','b','c'],'2':['x','y']}
demo2={1:['b','c','e'],2:['x','z','w']}
coef={'1':5,'2':6}
result = {i:sum(c in demo1[i] and c in demo2[int(i)] for c in set(demo1[i]+demo2[int(i)]))/coef[i] for i in demo1}

```

Output:

```
{'1': 0.4, '2': 0.16666666666666666}

```
You can convert the values to sets and find the length of the intersections

```
{k:len(set(demo1.get(k)).intersection(demo2.get(int(k))))/v for k,v in coef.items()}
{'1': 0.4, '2': 0.16666666666666666}

```