T
T
TanderOFF2021-04-07 08:37:36
Python
TanderOFF, 2021-04-07 08:37:36

TypeError: unsupported operand type(s) for divmod(): 'set' and 'int' how to execute divmod in a loop?

Hello ! I'm making a "Leader Board" by voice activity. i take value from base and already pass through divmod but i get error

m, s = divmod({row[0]}, 60) TypeError: unsupported operand type(s) for divmod(): 'set' and 'int'
since this action is not supported through a for loop, I don't know how to fix it. Please ask for help.

@client.command(aliases = ['toponline'])
async def __voicetop(ctx):
    embed = discord.Embed(title = 'Таблица лидеров по войс активности на \n [Æ]  ΛTMOSFΞRA', color=0xa697ff)
    counter = 0

    for row in cursor.execute("SELECT name, voice FROM users WHERE server_id = {} ORDER BY voice DESC LIMIT {} OFFSET 0".format(ctx.guild.id, 5)):
        m, s = divmod({row[0]}, 60)
        h, m = divmod(m, 60)
        counter += 1
        embed.add_field(
            name = f'#{counter}:trophy: | {round(h)}ч {round(m)}м ',
            value = f'Проговорил: {row[1]} <a:y_star:791077278309285908> ',
            inline = False).set_thumbnail(url="https://thumbs.gfycat.com/EasygoingPinkDobermanpinscher-small.gif")

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TanderOFF, 2021-04-07
@TanderOFF

Row[0] turned out to be a participant's nickname - the issue is closed . Row[0] => Row[1]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question