Skip to content

Tag: python-3.x

Can I improve this code to a more oriented OOP paradigm?

I am improving this code to a student, here is the image: So I rewrite this using list compreenssion and oriented to a formal class, so the second question is: Can I improve yet more this code? Answer Yes you can improve your code to be more “Object Oriented”. It doesn’t make sence that Alun…

Create subclass from superclass initializer in Python

Suppose I have a class Fruit and two Subclasses of it Orange(Fruit) and Banana(fruit) Fruit has an initializer, and I pass some parameters to it. But I don’t want it to just create and return a fruit necessarily, but based upon the parameters passed to it, to possibly return one of several different sub…