Home >>Python Random Module >Python Random choice() Method
Python Random choice() Method is an inbuilt method in python which is used to returns a randomly selected item from the specified list, a tuple, a string or any other kind of list.
Syntax:random.choice(sequence)
Parameter | Description |
---|---|
sequence | It is required and is a list, a tuple, a range of numbers etc. |
import random
myedu = ["Java", "Python", "mySql"]
print(random.choice(myedu))
import random
z = "PHPTPOINT"
print(random.choice(z))