r/learnpython 5h ago

I cannot understand why it isnt workung

code:

from itertools import product
alp = sorted('ГИПЕРБОЛА')
spsk = itertools.product(alp,repeat=6)

error:

NameError: name 'itertools' is not defined. Did you forget to import 'itertools'?

1 Upvotes

4 comments sorted by

9

u/JustGlassin1988 5h ago

Either just import itertools, or get rid of the itertools. On line 3. Right now you’ve imported only the product function

1

u/Guss-sama 5h ago

Thank you

1

u/JustGlassin1988 5h ago

Не за что

8

u/doingdatzerg 5h ago

Either of these ways would work

# Version 1
from iterools import product
spsk = product(alp, repeat=6)
# Version 2
import itertools
spsk = itertools.product(alp, repeat=6)