import random
import difflib
number = int(input("How many words do you want to practise?"))
words = [*3000 word array*]
for x in range(0, number):
text_1 = random.randint(0, 3000)
z = words[text_1]
print(z)
text_2 = str(input("Type:"))
seq = difflib.SequenceMatcher(isjunk=None, a=text_1, b=text_2)
difference = seq.quick_ratio()
difference = round(difference, 1)
print(str(difference) + "% Match")
print("Thank you!")
The Error message I kept getting: (Line 12)
for elt in self.a: TypeError: 'int' object is not iterable
I have been on a good flow with this program but reached this wall and have tried so many different ways of figuring it out but really couldn't. The program is meant to be a typing test/practice thing. I hope anyone here can help me figure out a solution for my error message, or any suggestions, in general, would be great.
Note: I am very new to this website, so I apologize if any 'format' I use is wrong.
SequenceMatcherto compare a user-inputted string to a randomly generated integer. Do you mean to be comparing the string representation of the random integer?text_1is an integer. Did you mean to passzinstead oftext_1, likea=z?