Untitled
import random import nltk from nltk.corpus import words # Download the words corpus if it's not already downloaded nltk.download('words') def generate_random_words(count=12): # Get the list of English words word_list = words.words() # Randomly select the desired number of words random_words = random.sample(word_list, count) # Join the words with spaces return " ".join(random_words) # Generate and print 12 random English words print(generate_random_words())
Leave a Comment