paint-brush
How to fix the Python TypeError: ‘int’ Object is not Iterableby@itsmycode
10,124 reads
10,124 reads

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

by Srinivas Ramakrishna2mSeptember 9th, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow
EN

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
Srinivas Ramakrishna

Srinivas Ramakrishna

@itsmycode

Solution Architect having 14+ Years of Experience in .NET Core, Python, Node.JS, JavaScript, Cloud (Azure), RDBMS

About @itsmycode
LEARN MORE ABOUT @ITSMYCODE'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

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

TOPICS

Languages

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite