Timothy Tseng3,292 Points
How come I can't iterate after coverting an int to str using str() (Solved)
Hi, how come when I try to run the below code I get a TypeError: 'int' object is not iterable
def maximum69Number (self, num: int) -> int: string = str(num) for digit in len(string): if digit == '6': digit = '9' break return int(string)
I realized using replace would be easier, but I'm just wondering why my for loop is causing a type error when I'm converting the number to a string.