Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. 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.
  2. class Dog(object):
  3. def __init__(self, weight):
  4. self.weight = weight
  5.  
  6. if __name__ == "__main__": # Explain how this works
  7. pug = Dog(10)
  8. hound = Dog(50)
  9. rottweiler = Dog(50)
  10. assert pug != hound
  11. assert hound == rottweiler
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement