Why i cannot import all functions using import itertools ? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 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... :)

28th Jun 2017, 1:32 PM
S.Naveen Kumar
S.Naveen Kumar - avatar
1 Réponse
+ 1
use for i in itertools.count(3):
28th Jun 2017, 3:21 PM
Da' BO$
Da' BO$ - avatar