10 puppies

Report a typo

You want your program to work in a way that at any given time there can be no more than 10 puppies. Define __new__ method so that this restriction is placed on the class.

Tip: Pay attention to the comparison symbols that you use. If there are already 10 puppies (10 instances of the class Puppy), you should NOT be able to create another one!

Write a program in Python 3
class Puppy:
n_puppies = 0 # number of created puppies

# define __new__
___

Create a free account to access the full topic