Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This question raises an AssertionError on the second assert statement. Please change the code in a way that no AssertionError is thrown. Compare the values(weight property) of these objects. Bonus points for implementing a solution using duck typing.
- class Dog(object):
- def __init__(self, weight):
- self.weight = weight
- if __name__ == "__main__": # Explain how this works
- pug = Dog(10)
- hound = Dog(50)
- rottweiler = Dog(50)
- assert pug != hound
- assert hound == rottweiler
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement