Create code that outputs "A and pretending B" in python
It is a memorandum when I created the code that outputs "A and pretending to be B" in python.
Use python's choice.
import random
l = ["Apple",
"Mandarin orange",
"Strawberry",
"pineapple",
"Dragon fruit"]
string1=random.choice(l)
string2=random.choice(l)
print(string1, "Pretending to be", string2)
$ python sample.py
Apples and dragon fruit pretending to be
Randomly select an element from a list in Python random.choice
Recommended Posts