Solution 1 - Direct Formula
Given a temperature in Celsius, convert it to Kelvin and Fahrenheit using the standard formulas: Kelvin = Celsius + 273.15 and Fahrenheit = Celsius * 1.80 + 32.00. Return both values as a list.
Given a temperature in Celsius, convert it to Kelvin and Fahrenheit using the standard formulas: Kelvin = Celsius + 273.15 and Fahrenheit = Celsius * 1.80 + 32.00. Return both values as a list.
""" 2469.1 - Solution 1 - Direct Formula """
#####################################################################################
# Imports
#####################################################################################
from typing import List
#####################################################################################
# Classes
#####################################################################################
class Solution:
"""Solution Class"""
def convertTemperature(self, celsius: float) -> List[float]:
"""Convert Temperature Function"""
kelvin = celsius + 273.15
fahrenheit = celsius * 1.80 + 32.00
return [kelvin, fahrenheit]
#####################################################################################
# Functions
#####################################################################################
def testcase():
"""Test Function"""
print(Solution().convertTemperature(36.50)) # [309.65, 97.70]
print(Solution().convertTemperature(122.11)) # [395.26, 251.798]
#####################################################################################
# Main
#####################################################################################
if __name__ == "__main__":
testcase()