Possible Duplicate:
How do I randomly select an item from a list using Python?
I am trying to create a string that uses 3 different lists for 3 different words:
print (word1[random.randint(0, X )],
"the",
word2[random.randint(0, X)],
word3[random.randint(0, X)])
word1
,word2
and word3
are different lists.
The X
in randint is the amount of strings in the respective lists.
So, could anybody help me out and tell me how i write this code correctly?
word1[random.randint(0, [amount of strings in list "word1"])]