
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)
output
World
If you restart the shell then it shows a different result.
Hello
if you have any doubt feel free to ask me on social media
Also, Read
Python Program to Check size of a file
Amazing tool Auto Copy paste Clipboard Using Python
Python Program to Check Prime Number
Python program to print odd numbers between 1 to 10 using a while loop.