This question already has an answer here:
I am trying to write a program in python 2.7 that has to choose more than one random variable and print it out. But the variable can't be the same as any of the previously printed out variables.
I have been looking around Google and this site, and I have yet to find anything for strings (I have only found integers so far). Here is an example:
sentences = [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p] print (random.choice(sentences)) + (random.choice(sentences)) + (random.choice(sentences)) >>> a + b + a
I don't want there to be duplicates, I want it to be like this:
>>> a + b + c
Is there any way this can be achieved?