###
from cmath import exp, pi
def FFT1(x):
N = len(x)
if N <= 1: return x
even = FFT1(x[0::2])
odd = FFT1(x[1::2])
return [even[k] + exp(-2j*pi*k/N)*odd[k] for k in range(N/2)] + \
[even[k] - exp(-2j*pi*k/N)*odd[k] for k in range(N/2)]
###
def FFT2():
x=[1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0]
qq1=FFT1(x)
print ('Matrix =',qq1)
Changed single slash (“/”) division to double slash integer division. The float result of the former was giving you the int expected error in the range function.