This question already has an answer here:
I want to get 2 elements from a list of 5 elements to iterate in a for loop in Python.
List = ["Item1","Item2","Item3","Item4","Item5",]
for item in List:
...Do Something...
I want random 2 items here and loop through only those two items.
ie. Item3 and Item5 randomly selected for the loop. Then loop ends.
Aucun commentaire:
Enregistrer un commentaire