Question: In python, please provide code that I can edit. Implement a class Address . An address has a house number, a street, an optional apartment

In python, please provide code that I can edit.

Implement a class Address. An address has a house number, a street, an optional apartment number, a city, a state, and a postal code. Define the constructor such that an object can be created in one of two ways: with an apartment number or without. Supply a method def print method that prints the address with the street on one line and the city, state and postal code on the next line. Supply a method def comesBefore(self,other) that tests whether this address comes before other when compared by postal code. Below is a partial program that runs the Address class. 5 pts

# Construct two address.

a = Address(2500, "University Drive", "Some City", "Some State", "12345")

b = Address(1200, "College Blvd", "Other City", "Other State", "99102", "12")

# Demonstrate the print method for Address a and Address b

xxx

xxx

# Demonstrate the comesBefore method.

xxx

Your code with comments

A screenshot of the execution

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!