How to fix the Python TypeError: ‘int’ Object is not Iterableby@itsmycode
7,747 reads

How to fix the Python TypeError: ‘int’ Object is not Iterable

tldt arrow
EN
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

Int objects are not directly iterable as they hold a single integer value and do not contain the \*\*‘`__iter__`‘ \** method. Instead of using int, try using list if it makes sense, and it can be iterated using for and while loop easily. Try using the `range()` method in the for loop, which will eventually generate a list of sequential numbers.
featured image - How to fix the Python TypeError: ‘int’ Object is not Iterable
Srinivas Ramakrishna HackerNoon profile picture

@itsmycode

Srinivas Ramakrishna


Receive Stories from @itsmycode

react to story with heart
Srinivas Ramakrishna HackerNoon profile picture
by Srinivas Ramakrishna @itsmycode.Solution Architect having 14+ Years of Experience in .NET Core, Python, Node.JS, JavaScript, Cloud (Azure), RDBMS
catchsrinivas

RELATED STORIES

L O A D I N G
. . . comments & more!
Hackernoon hq - po box 2206, edwards, colorado 81632, usa