






import unittest

from knapsack import greedy_knapsack as kp




class 							_lowerCAmelCase(			unittest.TestCase   ):





       """simple docstring"""







       def      _a       (   self				):
         UpperCamelCase_:   int        =							[1_0, 2_0, 3_0, 4_0, 5_0, 6_0]
         UpperCamelCase_:   str        =							[2, 4, 6, 8, 1_0, 1_2]
         UpperCamelCase_:   Tuple        =							1_0_0
         self.assertEqual(kp.calc_profit(lowerCAmelCase_    ,     lowerCAmelCase_    ,     lowerCAmelCase_				)    ,     2_1_0				)





       def      _a       (   self				):
         self.assertRaisesRegex(lowerCAmelCase_    ,     'max_weight must greater than zero.'				)





       def      _a       (   self				):
         self.assertRaisesRegex(lowerCAmelCase_    ,     'Weight can not be negative.'				)





       def      _a       (   self				):
         self.assertRaisesRegex(lowerCAmelCase_    ,     'Profit can not be negative.'				)





       def      _a       (   self				):
         self.assertRaisesRegex(lowerCAmelCase_    ,     'max_weight must greater than zero.'				)





       def      _a       (   self				):
         self.assertRaisesRegex(
             lowerCAmelCase_    ,     'The length of profit and weight must be same.'				)


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





'''simple docstring'''


from math import pi, sqrt
def 						snake_case_       (UpperCamelCase			:    float ):





							'''simple docstring'''


							if num <= 0:
														raise ValueError('''math domain error''' )
							if num > 171.5:
														raise OverflowError('''math range error''' )
							elif num - int(UpperCamelCase ) not in (0, 0.5):
														raise NotImplementedError('''num must be an integer or a half-integer''' )
							elif num == 0.5:
														return sqrt(UpperCamelCase )
							else:
														return 1.0 if num == 1 else (num - 1) * gamma(num - 1 )
def 						snake_case_       ():





							'''simple docstring'''


							assert gamma(0.5 ) == sqrt(UpperCamelCase )
							assert gamma(1 ) == 1.0
							assert gamma(2 ) == 1.0


if __name__ == "__main__":
				from doctest import testmod

				testmod()
				_snake_case : Optional[Any]  				=						1.0
				while num:
								_snake_case : Dict  				=						float(input('Gamma of: '))
								print(F'''gamma({num}) = {gamma(num)}''')
								print('\nEnter 0 to exit...')

