samedi 13 novembre 2021

Randomizing a value inside a component of a list of tuples

Ok, so I want to randomize a value from a component that belongs to a list of tuples. Here's an example of what I mean:

tuples=[('green', 40.0079), ('black', 50.0026), ('white', 60.941), ('yellow', 90.01218)]

So, here I want to return "black" for example, not "black 50.0026". So I just want the first parameter to be randomized!




Aucun commentaire:

Enregistrer un commentaire