File: LP6E/AppendixB/Part3/power_b.py

L = [1, 2, 4, 8, 16, 32, 64]
X = 5

for p in L:
    if (2 ** X) == p:
        print((2 ** X), 'was found at', L.index(p))
        break
else:
    print(X, 'not found')



[Home page] Books Code Blog Python Author Train Find ©M.Lutz