"Roelof Wobben" <rwob...@hotmail.com> wrote

Create and print a Point object, and then use id to print the
object’s unique identifier. Translate the hexadecimal form into decimal and
confirm that they match.

I initially had no idea what hexadecimal form the text is talking about.
id returns a decimal form... This is a badly worded assignment.

class Point:
    def __init__(self, x=0, y=0):
        self.x = x
        self.y = y

P=(Point)
a=0
b=0

The two a,b assigments are seemingly pointless?

a=id(P)
print a
print b
print P

Why do you want to print b which will  be zero?

However your print P gave me a clue to what the assignment is about.
When you print the object it gives you a hex value I think they want you to extract that value and convert it to decimal to see if its the same
as the value id() gives you.
At least that's the only sane thing I can think it means!

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to