What does `class Coordinate(object):` actually tell Python, and why is implementing a type a separate job from using it?
Short drills on what this video just taught. Write the code, run the checks, and reveal the answer only if you are stuck.
Write the class statement for the object type from the video: a coordinate in a two-dimensional plane, named Coordinate, whose parent is the generic Python object. Beneath the header put a docstring — a plain-English description, in triple quotes — saying it is made up of an x value and a y value.
Then hand the class itself to coordinate_class, the way a variable gives you a handle on an object. Assign the class, not an instance of it — nothing is created in this exercise.
Defining a type against creating objects of it
Record the two activities side by side and the parallel with functions, where writing the class matches writing a def and creating an object matches calling that function.
The coordinate data abstraction and its behaviors
Write down the two numbers, an x distance and a y distance, and list the three behaviors: report x, report y, and compute the Euclidean distance to another coordinate.
The class statement and its parent
Copy class Coordinate(object): with its docstring, note that the name becomes the new type and object the parent, and record that the body holds data attributes plus methods.