# 算法概述

`nums = []for i in range(100000):    nums.append(i)nums.reverse()`
`nums = []for i in range(100000):    nums.insert(0, i)`
`a, b = 0, 1for num in range(1, 101):    a, b = b, a + b    print(f'{num}: {a}')`
`def fib(num):    if num in (1, 2):        return 1    return fib(num - 1) + fib(num - 2)for num in range(1, 101):    print(f'{num}: {fib(num)}')`
`def fib(num, temp={}):    if num in (1, 2):        return 1    elif num not in temp:        temp[num] = fib(num - 1) + fib(num - 2)    return temp[num]`
`from functools import lru_cache@lru_cache()def fib(num):    if num in (1, 2):        return 1    return fib(num - 1) + fib(num - 2)`

# 穷举法

`import reimport PyPDF2with open('Python_Tricks_encrypted.pdf', 'rb') as pdf_file_stream:    reader = PyPDF2.PdfFileReader(pdf_file_stream)    with open('dictionary.txt', 'r') as txt_file_stream:        file_iter = iter(lambda: txt_file_stream.readline(), '')        for word in file_iter:            word = re.sub(r'\s', '', word)            if reader.decrypt(word):                print(word)                break`

Written by