I am trying to test if the decimal representation of a certain number contains the digit 9 at least twice, so I decided to do something like that:
i=98759102
string=str(i)
if '9' in string.replace(9, '', 1): print("y")
else: print("n")
But Python always responds with "TypeError: Can't convert 'int' object to str implicitly".
What am I doing wrong here? Is there actually a smarter method to detect how often a certain digit is contained in the decimal representation of an integer?
See Question&Answers more detail:os