In this Python program, we will be creating Python Program to choose a random word from the list. As similar to randint it remains the same. In this, we import choice instead of randint.
at first, we have to write a python module from random import choice after that we have to make a variable inside that variable we to put a random word with a comma and double invatedcomma then make the choice form the names the print the random word
Python Program to choose a random word from the list [Source code]
from random import choice names= ['Python', 'World', 'India', 'Hello'] player= choice(names) print(player)
If you restart the shell then it shows a different result.
if you have any doubt feel free to ask me on social media