[Python] How do I select a random object from a list of objects?

Discussão em 'Python' iniciado por Stack, Outubro 23, 2024.

  1. Stack

    Stack Membro Participativo

    I have a list of 10 x 10, with objects like this:

    self.taula = [[casella() for i in range(10)] for j in range(10)]


    How do I select a random object from this list?

    I've been trying but of course I don't have any integer to use as an index, I'm pretty new to coding so I might be doing something wrong.

    Continue reading...

Compartilhe esta Página