I'm wondering if it's possible to do random.choice() for a list of lists and only pick a coordinate which is 0. Also is it possible two then save the randomly picked coordinate to a variable?
I.e I have a list of lists like so:
[[0, 2, 0, 0, 0],
[0, 0, 0, 0, 1],
[0, 0, 1, 2, 0],
[0, 2, 0, 0, 0],
[0, 0, 0, 0, 0]]
And I only want to pick those coordinates which is 0, and then save that coordinate to variable.
Thanks.
Aucun commentaire:
Enregistrer un commentaire