lundi 28 juin 2021

So I made list of words in text document and it's updating after button is pressed. Words are displayed randomly

So this code is made with python and kivy. Problem is that sometimes words may appear more than once. Basically, it's repeating some words. The goal is that I don't want to repeat a single specific word more than once. Here's my python code:

file = open("words.txt", "r", encoding="utf8")
file = file.read()

individual_words = file.split()
random_number = randint(0, len(individual_words))
self.ids.words_areva.text = str(individual_words[random_number])



Aucun commentaire:

Enregistrer un commentaire