


"""simple docstring"""





def      _snake_case						(						_snake_case				:			list[list[float]]			):
      lowerCAmelCase					:	list[list[float]]       =   []
      for data in source_data:
            for i, el in enumerate(_snake_case			):
                  if len(_snake_case			) < i + 1:
                        data_lists.append([]			)
                  data_lists[i].append(float(_snake_case			)			)
      return data_lists


def      _snake_case						(						_snake_case				:			list[list[float]] ,   _snake_case				:			list[int]			):
      lowerCAmelCase					:	list[list[float]]       =   []
      for dlist, weight in zip(_snake_case ,   _snake_case			):
            lowerCAmelCase					:	Tuple       =   min(_snake_case			)
            lowerCAmelCase					:	Optional[int]       =   max(_snake_case			)

            lowerCAmelCase					:	list[float]       =   []
            # for weight 0 score is 1 - actual score
            if weight == 0:
                  for item in dlist:
                        try:
                              score.append(1 - ((item - mind) / (maxd - mind))			)
                        except ZeroDivisionError:
                              score.append(1			)

            elif weight == 1:
                  for item in dlist:
                        try:
                              score.append((item - mind) / (maxd - mind)			)
                        except ZeroDivisionError:
                              score.append(0			)

        # weight not 0 or 1
            else:
                  lowerCAmelCase					:	Optional[int]       =   f'''Invalid weight of {weight:f} provided'''
                  raise ValueError(_snake_case			)

            score_lists.append(_snake_case			)

      return score_lists


def      _snake_case						(						_snake_case				:			list[list[float]]			):
      lowerCAmelCase					:	list[float]       =   [0 for i in range(len(score_lists[0]			)			)]

      for slist in score_lists:
            for j, ele in enumerate(_snake_case			):
                  lowerCAmelCase					:	Optional[Any]       =   final_scores[j] + ele

      return final_scores






def      _snake_case						(						_snake_case				:			list[list[float]] ,   _snake_case				:			list[int]			):
      lowerCAmelCase					:	int       =   get_data(_snake_case			)
      lowerCAmelCase					:	List[str]       =   calculate_each_score(_snake_case ,   _snake_case			)
      lowerCAmelCase					:	Dict       =   generate_final_scores(_snake_case			)

      # append scores to source data
      for i, ele in enumerate(_snake_case			):
            source_data[i].append(_snake_case			)

      return source_data






"""simple docstring"""





def      _snake_case						(						_snake_case				:			float ,   _snake_case				:			list[float]			):
      if discount_rate < 0:
            raise ValueError('''Discount rate cannot be negative'''			)
      if not cash_flows:
            raise ValueError('''Cash flows list cannot be empty'''			)
      lowerCAmelCase					:	List[str]       =   sum(
          cash_flow / ((1 + discount_rate) ** i) for i, cash_flow in enumerate(_snake_case			)			)
      return round(_snake_case ,   ndigits=2			)


if __name__ == "__main__":
 import doctest

 doctest.testmod()


