import random
p = ['hello','hey','hi'],['brother','bro','sir'],['me','myself'],['a'],['hero']
print(random.choices(random.choices(p)))
Desired output : hello bro myself a hero
import random
p = ['hello','hey','hi'],['brother','bro','sir'],['me','myself'],['a'],['hero']
print(random.choices(random.choices(p)))
Desired output : hello bro myself a hero
Use random.choice
not random.choices
import random
p = ['hello','hey','hi'],['brother','bro','sir'],['me','myself'],['a'],['hero']
selection = [random.choice(x) for x in p]
output = ' '.join(selection)
print(output)
# "hello bro myself a hero" (or something else, it's random)
You can try this:
import itertools
import random
' '.join(list(itertools.chain(*list(map(random.choices, p)))))
# 'hey bro me a hero'