Bittersweet occasion

Report a typo

Mysterious things have happened on the Hogwarts Express! Someone enchanted a food trolley and all the goodies got mixed up on the shelves. While the trolley witch is looking for the culprit, you will place Drinks, Pastry and Sweets on three respective shelves.

These three are base classes and have various unknown children: for example, PumpkinJuice inherits from Drinks. Write a function that finds a parent class for an unknown class (not an instance of a class) stored in the variable child and prints out the parent's name.

Note: all these classes are already created, you don't need to do that yourself. You only need to work with the child.

Tip: You can use the issubclass() function to check if a particular class is the parent class and class.__name__ to print out the name of a class.

Write a program in Python 3
# finish the function
def find_the_parent(child):
...
___

Create a free account to access the full topic