Sunday, May 30, 2021

TypeError: 'int' object is not iterable

I am starting to believe that the word "TypeError" is used in python with two meanings, first it indicates an invalid pair of data type and operation. Secondly it says "Oh a typo is encountered, looks like you forgot to type in something" and hence the TypeError !

I forgot to type range() in a for loop and it immediately reminded me about by giving an error 

TypeError: 'int' object is not iterable


😃😃

You will also get it if you forget to type range in a for loop : 

x = 5
for i in x:              #since x is obviously not iterable

We probably intended something like below : 

x = 5 
for i in range(x) : 

No comments:

Post a Comment

 using Microsoft.AspNetCore.Mvc; using System.Xml.Linq; using System.Xml.XPath; //<table class="common-table medium js-table js-stre...