Skip to content

Commit 7aa909f

Browse files
committed
Int is not iterable
1 parent 2f9c287 commit 7aa909f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

generators.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,13 @@ iterable. While an ``int`` isn't an iterable, we can use it on string!
157157

158158
.. code:: python
159159
160+
int_var = 1779
161+
iter(int_var)
162+
# Output: Traceback (most recent call last):
163+
File "<stdin>", line 1, in <module>
164+
TypeError: 'int' object is not iterable
165+
# This is because int is not iterable
166+
160167
my_string = "Yasoob"
161168
my_iter = iter(my_string)
162169
next(my_iter)

0 commit comments

Comments
 (0)