Skip to content Skip to sidebar Skip to footer

Frequency Analysis Issues With Tuple Error

In the match_letters function, with 'place = string.index(letter)' i keep recieving the same error of 'Value Error: tuple.index(x): x not a tuple.' Does anyone know how to solve th

Solution 1:

The variable string you're passing to match_letters here:

string = descending_order(letterCount)
finish = match_letters(ETAOIN, string,text)

is not really a string (or list), it's a tuple from descending_order:

return Letter_Count_Tuple, new_letter_Count, string

Either return just the string in descending_order or pick it up properly from the returned tuple:

_,_,string = descending_order(letterCount)

(I'm assuming that the string inside descending_order is the one you want in match_letters)

Post a Comment for "Frequency Analysis Issues With Tuple Error"