Python - TypeError: 'int' object is not iterable

This error message is indicating that you are trying to iterate over an object of type 'int', which is not iterable (i.e. it doesn't support the iteration protocol). Here's an example of code that would raise this error:

x = 5
for i in x:
    print(i)

This code tries to iterate over the integer variable x, but integers are not iterable in Python. You can iterate over a sequence like a list or a string.

Watch a course Python - The Practical Guide

A possible solution would be to convert the integer to a list or a string before iterating over it.

x = 5
for i in str(x):
    print(i)

or

x = [1,2,3,4,5]
for i in x:
    print(i)