vendredi 14 décembre 2018

Choosing item in specific place from list of lists

I have list of lists:

list = [[abc,defg,hij],[klm,nopqrs,tuvw],[xy,zabc,def],[ghij,klmnop,qrs]]

I want to choose random list from all the lists and print the string in the 2nd location.

i tried:

for item in list:
    print(random.choise(item[2])

it doesn't show all the string, just one letter.




Aucun commentaire:

Enregistrer un commentaire