

'''simple docstring'''


lowerCAmelCase__						:       dict[str, float]										=						{
    "joule": 1.0,
    "kilojoule": 1000,
    "megajoule": 1000000,
    "gigajoule": 1000000000,
    "wattsecond": 1.0,
    "watthour": 3600,
    "kilowatthour": 3600000,
    "newtonmeter": 1.0,
    "calorie_nutr": 4186.8,
    "kilocalorie_nutr": 4186800.00,
    "electronvolt": 1.602_176_634E-19,
    "britishthermalunit_it": 1055.05585,
    "footpound": 1.355818,
}




def 	_a       (				__lowerCAmelCase		:      str   ,							__lowerCAmelCase		:      str   ,							__lowerCAmelCase		:      float     ):

		"""simple docstring"""

		if to_type not in ENERGY_CONVERSION or from_type not in ENERGY_CONVERSION:
				snake_case__						:       int       						=  (
				    F"""Incorrect 'from_type' or 'to_type' value: {from_type!r}, {to_type!r}\n"""
				    F"""Valid values are: {', '.join(__lowerCAmelCase     )}"""
				)
				raise ValueError(__lowerCAmelCase     )
		return value * ENERGY_CONVERSION[from_type] / ENERGY_CONVERSION[to_type]


if __name__ == "__main__":
					import doctest

					doctest.testmod()






'''simple docstring'''


def 	_a       (				__lowerCAmelCase		:      float   ,							__lowerCAmelCase		:      float   ,							__lowerCAmelCase		:      int     ):

		"""simple docstring"""

		if principal <= 0:
				raise Exception('''Principal borrowed must be > 0'''     )
		if rate_per_annum < 0:
				raise Exception('''Rate of interest must be >= 0'''     )
		if years_to_repay <= 0 or not isinstance(__lowerCAmelCase   ,							__lowerCAmelCase     ):
				raise Exception('''Years to repay must be an integer > 0'''     )

		# Yearly rate is divided by 12 to get monthly rate
		snake_case__						:       int       						=  rate_per_annum / 12

		# Years to repay is multiplied by 12 to get number of payments as payment is monthly
		snake_case__						:       Tuple       						=  years_to_repay * 12

		return (
		    principal
		    * rate_per_month
		    * (1 + rate_per_month) ** number_of_payments
		    / ((1 + rate_per_month) ** number_of_payments - 1)
		)


if __name__ == "__main__":
					import doctest

					doctest.testmod()



