I have a list:
background = ["blue", "green", "pink", "purple", "yellow"]
And there are two "versions" of random.choices I tried (one indexing something and the other not indexing something)
choice = random.choices(background)
And the other one:
choice - random.choices(background)[0]
The output of version one is, for example:
["blue"]
And version two:
blue
My question here is, how exactly does the indexing in this example work? Wouldn't an index of [1] give you the output of b
or l
?
Aucun commentaire:
Enregistrer un commentaire