I’ve struggled a bit with this exercise, and used the hint. I made the code following what the hint said as follows:
s = 0
t = 0
l = 0
def digit_sum(n): n = str(n) for i in n: l = int(i) t += l print (t) digit_sum(1234)
The code should convert the argument into a string, then convert it into a integer on another variable, then have the variable “t” totalling it up. It returned me an error saying “local variable ‘t’ referenced before assignment”
What does this mean? And how can I fix this?