print("Welcome to the unit converter!")
decision = input("Please enter what you want to convert.\nTemperature (type 't') \nVolume (type 'v') \n ")

#----------------------
#Temperature conversion (all units)
#----------------------

class Temperature:
    
    def __init__(self, initial, final, amount):
            self.initial = initial
            self.final = final
            self.amount = amount
    
    def run(self):
        
        def celsius(self):
            
            if self.final == "f":
                num = self.amount * 1.8 + 32
                print(f"{self.amount}°C is {num}°F.")  
            
            elif self.final == "k":
                num = self.amount + 273.15
                print(f"{self.amount}°C is {num}°K.")
        
        def fahrenheit(self):
            
            if self.final == 'c':
                num = (self.amount - 32) / 1.8
                print(f"{self.amount}°F is {num}°C.")
            
            elif self.final == 'k':
                num = (self.amount + 459.67) * (5/9)
                print(f"{self.amount}°F is {num}°K.")
                
            

        def kelvin(self):
            
            if self.final == 'c':
                num = self.amount - 273.15
                print(f"{self.amount}°K is {num}°C.")
            
            elif self.final == 'f':
                num = 1.8 * (self.amount - 273) + 32
                print(f"{self.amount}°K is {num}°F.")
            
        
        if self.initial == "c":
            celsius(self)
        
        elif self.initial == "f":
            fahrenheit(self)
            
        elif self.initial == "k":
            kelvin(self)
        
class Volume:
    
    def __init__(self, initial, final, amount):
        self.initialvolume = initialvolume
        self.finalvolume = finalvolume
        self.volamount = volamount
        
    def run(self):
        
        #CUBIC METERS
        
        def cubicmeters(self):
            if self.final == "b":
                num = self.amount * 6.2898
                print(f"{self.amount}m³ is {num} barrels.")
            
            elif self.final == 'ft3':
                num = self.amount / 0.0283168466
                print(f"{self.amount}m³ is {num}ft cubed.")
                
            elif self.final == "dm3":
                num = self.amount * 1000
                print(f"{self.amount}m³ is {num} cubic decimeters.")
                
        if self.initialvolume == "m3":
            cubicmeters(self)
        
if decision == 't':
    
    initial = input("Please enter what unit you would like to convert. \nCelsius (type 'c') \nFahrenheit (type 'f') \nKelvin (type 'k') \n")
    
    
    if initial == 'c':
        final = input("Please enter what unit you would like to convert Celsius into: \nFahrenheit (type 'f') \nKelvin (type 'k') \n")
        amount = int(input("Please enter the amount of degrees in Celsius you would like to convert: "))
    elif initial == 'f':
        final = input("Please enter what unit you would like to convert Fahrenheit into: \nCelsius (type 'c') \nKelvin (type 'k') \n")
        amount = int(input("Please enter the amount of degrees in Fahrenheit you would like to convert: "))
    elif initial == 'k':
        final = input("Please enter what unit you would like to convert Kelvin into: \nCelsius (type 'c') \nFahrenheit (type 'k') \n")
        amount = int(input("Please enter the amount of degrees in Kelvin you would like to convert: "))
        
    temp = Temperature(initial, final, amount)
    temp.run()
    
elif decision == 'v':
    initial = input("Please enter what unit you would like to convert. \nCubic meters (type 'm3') \n")
    
    if initial == "m3":
        final = input("Please enter what unit you would like to convert cubic meters to: \nBarrels (type 'b') \nCubic feet (type 'ft3') \nCubic decimeters (type 'dm3')")
        amount = int(input("Please enter the amount of cubic meters you would like to convert: "))
        
    vol = Volume(initial, final, amount)
    vol.run()
 
by