Russian Dolls
This solution makes use of three additional functions to what was originally given in the starter code:
It starts with inner_unpack_dolls - this function does a few different things:
-
Unpacks the current doll by calling the dolls print_unpack method. This outputs the “Unpacking a {self.colour} doll of size: {self.size} with {self.get_number_of_children()} nested dolls inside” line to the console.
- This makes use of the dolls get_number_of_children method. This method makes use of recursion to work out how many child dolls the doll has inside of it.
- Checks if the doll has a child inside of it, if it doesn’t then 1 is returned (this ...