python using the fibonacci sequence
<p>I am trying to only have the words print out if they occur the same number of times as in the fibonacci sequence.  If a words show up 1,2,3,5,8 etc then it will print up.  I have gotten the program to print up the words based on how many times the appear.  I am having trouble figuring out how to use the sequence in my program.  Any tips or examples would be very appreciated.</p>

<pre><code>def fib():
    a,b = 0, 1
    while 1:
            yield a
            a, b= b, a+b

from collections import Counter 
import string


while True:
    filename=raw_input('Enter a file name: ')
    if filename == 'exit':
        break
    try:
        file = open(filename, 'r') 
        text=file.read() 
        file.close() 
    except:
        print('file does not exist')
    else:

        for word in string.punctuation:
            text=text.replace(word, "")
        word_list = text.lower().split(None)
        word_freq = {}

        for word in word_list:
            if len(word) &gt; 1:
                word_freq[word] = word_freq.get(word, 0) + 1

        print(sorted(word_freq.items(), key=lambda item: item[1])) 
// I am pretty sure something with the seqeunce should go into the above line
// but have been unable to figure it out.         

print('Bye')
</code></pre>
