TypeError: object of type ‘int’ has no len() – Python/Pygame

If you just want the value of self.cookie_count, you can just use

self.draw_text('Cookies: {}'.format(self.cookie_count)

The len() function returns the number of items in an object such as an array and does not work on an int object.

Leave a Comment