mercredi 28 juin 2023

I want to print a random sentecnce from my list every time i type x in input

import random
words = ["tree", "human", "city", "night", 
"falcon", "last", "first", "fruit", "animals", 
"often", "maybe", "through", "work", 
"good","random", "white"]
while True:
    sentence = input("print x: ")
    random_sentence = random.choice(words)
    print(random_sentence)

# i want it to be random sentence like this:
city last human fruit white animals often tree work through good random maybe falcon night first



Aucun commentaire:

Enregistrer un commentaire