'''simple docstring'''




def 							snake_case__				(     _A:   float ,  _A:   list[float]					)       ->      float:

		'''simple docstring'''


		if discount_rate < 0:
				raise ValueError("""Discount rate cannot be negative"""					)
		if not cash_flows:
				raise ValueError("""Cash flows list cannot be empty"""					)
		lowerCAmelCase     =    sum(
		    cash_flow / ((1 + discount_rate) ** i) for i, cash_flow in enumerate(_A					)					)
		return round(_A ,  ndigits=2					)


if __name__ == "__main__":
						import doctest

						doctest.testmod()





'''simple docstring'''




def 							snake_case__				(     _A:   int					)       ->      list[int]:

		'''simple docstring'''


		if length <= 0 or not isinstance(_A ,  _A					):
				raise ValueError("""Length must be a positive integer."""					)
		return [n * (2 * n - 1) for n in range(_A					)]


if __name__ == "__main__":
						print(hexagonal_numbers(length=5))
						print(hexagonal_numbers(length=1_0))




