Ask coding questions

← Back to all posts
I got an error.
BearCoder01

I try to make a game, but I've got an error in the code.
It say's TypeError: object of type 'int' has no len(). Please help me.

Voters
BearCoder01
Comments
hotnewtop
VulcanWM

Oh it means you cannot use the len function in an integer.
To find the number of digits in a number covert it to a string first using str()

BearCoder01

@VulcanWM Ok, i will check out.

BearCoder01

@VulcanWM Still got an error but on line 105.

VulcanWM

You know you can loop thru a list by doing for item in items, so items will be the list of the item @BearCoder01

BearCoder01

@VulcanWM I got that but what you mean but what says this error
TypeError: 'int' object is not subscriptable

VulcanWM

Change the loop to the code I told you above and I’ll help you after that
Or you can give me the invite link and I’ll fix it @BearCoder01

BearCoder01

@VulcanWM I will invite you. I have invited you.

BearCoder01

@VulcanWM What you did with the loop works, but when you type in a item from the list then it's gives an error?