how to get a random item in a string in pyton code example
Example 1: Javascript get random item from array
var colors = ["red","blue","green","yellow"];
var randomColor = colors[Math.floor(Math.random()*colors.length)]; //pluck a random color
Example 2: python choose random element from list
import random
#1.A single element
random.choice(list)
#2.Multiple elements with replacement
random.choices(list, k = 4)
#3.Multiple elements without replacement
random.sample(list, 4)