I'd like you to write a class representing a 3-dimensional point.
The Point class must accept 3 values on initialization (x, y, and z) and have
It must also have a helpful string representation.
Additionally, point objects should be comparable to each other (two points are equal if their coordinates are the same and not equal otherwise).
>>> p1 = Point(1, 2, 3) >>> p1 Point(x=1, y=2, z=3) >>> p2 = Point(1, 2, 3) >>> p1 == p2 True >>> p2.x = 4 >>> p1 == p2 False >>> p2 Point(x=4, y=2, z=3)
If you finish the base exercise quickly, consider working through a bonus or two.
This is just a preview of the problem statement.
This exercise includes 3 bonuses, 10 hint links, and automated tests.
To solve this exercise, sign in to your Python Morsels account.
My name is Trey Hunner and I hold Python trainings for teams. I've spent countless hours refining my most interesting Python exercises into Python Morsels, a Python skill-building platform for folks who already know Python.
Python Morsels is design to help you improve your Python skills every week through 1 hour of deliberate practice.
Let me help you write more beautiful Python code. Sign up for Python Morsels to access this exercise and many more.Join Python Morsels ✨