The random.choice() function chooses a character at random from a string. To select a random element from a string, use the code below.
# random.choice() method
# importing random module
import random
# prints random character from the given string
string1 = "similar"
print(random.choice(string1))
Output:
m
Also Read:
Select Random Element from List : Python