Why i cannot import all functions using import itertools ? | Sololearn: Learn to code for FREE!

+1

Why i cannot import all functions using import itertools ?

from itertools import count for i in count(3): print(i) if(i>11): break Output: 3 4 5 6 7 8 9 10 11 12 ******************************************************************************************************** But now using this: import itertools for i in count(3): print(i) if(i>11): break Output: NameError: name 'count' is not defined Why does this occur?? Thanking u in advance... :)

6/28/2017 1:32:39 PM

S.Naveen Kumar

1 Answer

New Answer

+1

use for i in itertools.count(3):