



'''simple docstring'''

from __future__ import annotations







def 						__UpperCamelCase				(							_lowercase					) ->			float:
	_lowercase					:       Any       =		0.0_0
	_lowercase					:       Any       =		0
	for resistor in resistors:
		if resistor <= 0:
			_lowercase					:       Optional[Any]       =		f'''Resistor at index {index} has a negative or zero value!'''
			raise ValueError(_lowercase					)
		first_sum += 1 / float(_lowercase					)
		index += 1
	return 1 / first_sum







def 						__UpperCamelCase				(							_lowercase					) ->			float:
	_lowercase					:       str       =		0.0_0
	_lowercase					:       Optional[Any]       =		0
	for resistor in resistors:
		sum_r += resistor
		if resistor < 0:
			_lowercase					:       str       =		f'''Resistor at index {index} has a negative value!'''
			raise ValueError(_lowercase					)
		index += 1
	return sum_r


if __name__ == "__main__":
		import doctest

		doctest.testmod()





'''simple docstring'''

import unittest

from knapsack import greedy_knapsack as kp



class 		lowerCamelCase__      (						unittest.TestCase     ):




					'''simple docstring'''



					def 						__UpperCAmelCase     (  self				:	int					)  ->       Any:



						'''simple docstring'''





						_lowercase					:       List[Any]       =		[10, 20, 30, 40, 50, 60]
						_lowercase					:       Tuple       =		[2, 4, 6, 8, 10, 12]
						_lowercase					:       Optional[Any]       =		100
						self.assertEqual(kp.calc_profit(UpperCamelCase_     ,  UpperCamelCase_     ,  UpperCamelCase_					)     ,  210					)




					def 						__UpperCAmelCase     (  self				:	int					)  ->       int:



						'''simple docstring'''





						self.assertRaisesRegex(UpperCamelCase_     ,  'max_weight must greater than zero.'					)




					def 						__UpperCAmelCase     (  self				:	Dict					)  ->       Optional[Any]:



						'''simple docstring'''





						self.assertRaisesRegex(UpperCamelCase_     ,  'Weight can not be negative.'					)




					def 						__UpperCAmelCase     (  self				:	List[Any]					)  ->       Optional[Any]:



						'''simple docstring'''





						self.assertRaisesRegex(UpperCamelCase_     ,  'Profit can not be negative.'					)




					def 						__UpperCAmelCase     (  self				:	int					)  ->       List[str]:



						'''simple docstring'''





						self.assertRaisesRegex(UpperCamelCase_     ,  'max_weight must greater than zero.'					)




					def 						__UpperCAmelCase     (  self				:	int					)  ->       List[Any]:



						'''simple docstring'''





						self.assertRaisesRegex(
						    UpperCamelCase_     ,  'The length of profit and weight must be same.'					)


if __name__ == "__main__":
		unittest.main()
