>>> str(10)
'10'
>>> int('10')
10

Links to the documentation:

The problem seems to come from this line: d.str().

Conversion to a string is done with the builtin str() function, which basically calls the __str__() method of its parameter.

How to Convert a Python String to int – Real Python

https://realpython.com/convert-python-string-to-int/

Integers are whole numbers. In other words, they have no fractional component. Two data types you can use to store an integer in Python are int and str .

Convert integer to string in Python - Stack Overflow

https://stackoverflow.com/questions/961632/convert-integer-to-string-in-python

There are several ways to convert an integer to string in python. You can use [ str(integer here) ] ...

Converting integer to string in PythonPython Principles

https://pythonprinciples.com/blog/converting-integer-to-string-in-python/

To convert an integer to a string, use the str() built-in function. The function takes an int as input and produces a string as its output.

String to Integer (atoi) - LeetCode

https://leetcode.com/problems/string-to-integer-atoi/

String to Integer (atoi) - Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer (similar to C/C++'s atoi function).