Python: 'str' object is not callable

Call the variable something other than str. It is shadowing the str built in function.


It's because you overrode the function str on line 3.

str() is a builtin function in Python which takes care of returning a nice string representation of an object.

Change line 3 from

str = '0123456789'

to

number_string = '0123456789'