diff options
-rw-r--r-- | Convert.py | 33 |
1 files changed, 24 insertions, 9 deletions
@@ -18,16 +18,31 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + class convert(): - def __init__(self, number, uni1, uni2, type_u, ): + def __init__(self, number, uni1, uni2, type_u): super(convert, self).__init__() - self.list = {"long": {}, - "vol": {}, - "area": {}, - "peso": {}, - "vel": {}, - "time": {}} + self.long = {} + self.vol = {} + self.area = {} + self.peso = {} + self.vel = {} + self.time = {} + + if type_u == "long": + self.dic = self.long + elif type_u == "vol": + self.dic = self.vol + elif type_u == "area": + self.dic = self.area + elif type_u == "peso": + self.dic = self.peso + elif type_u == "vel": + self.dic = self.vel + elif type_u == "time": + self.dic = self.time + + self.a = number * self.dic[uni1] - self.a = number * self.list[type_u][uni1] - return self.a * self.list[type_u][uni2] + return self.a * self.dic[uni2] |