Building useful classes 11/11 - unsupported format error


returns error:
Traceback (most recent call last):
File “python”, line 10, in
File “python”, line 7, in repr
ValueError: unsupported format character ‘)’ (0x29) at index 11

I expect (1, 2, 3) to print as a result of print my_point

class Point3D(object):
  def __init__(self,x,y,z):
  def __repr__(self):
    return "(%d, %d, d%)" % (self.x,self.y,self.z)

my_point = Point3D(1, 2, 3)
print my_point


line 7, it seems the ) you use invalid. use a valid closing parenthis


Hello, I’m struggling to understand. Do you mean the ) after self.z in line 7?


well, look at the error message:

ValueError: unsupported format character ‘)’ (0x29) at index 11

the ) character you use at line 7 is invalid, type valid one, or copy this one: )


Unfortunately copying and pasting that did not change the error message. I’m not understanding how my ) needs to be replaced with a different )


what did you do? simplest solution, simply retype the entire line:

return "(%d, %d, %d)" % (self.x, self.y, self.z)


Got it - I retyped the entire line and that fixed it. I’m still not sure how that ) was invalid… Thanks!


not a valid ascii value it seems. Important thing is that the issue is resolved