






from math import pi, sqrt





def 					lowercase_ (    __snake_case     :							float      )     -> float:





				'''simple docstring'''


				if num <= 0:
								raise ValueError("math domain error"      )
				if num > 1_71.5:
								raise OverflowError("math range error"      )
				elif num - int(__snake_case      ) not in (0, 0.5):
								raise NotImplementedError("num must be an integer or a half-integer"      )
				elif num == 0.5:
								return sqrt(__snake_case      )
				else:
								return 1.0 if num == 1 else (num - 1) * gamma(num - 1      )





def 					lowercase_ (    )     -> None:





				'''simple docstring'''


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


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

	testmod()
	__UpperCAmelCase							:   str							=  1.0
	while num:
		__UpperCAmelCase							:   List[str]							=  float(input("Gamma of: "))
		print(F'''gamma({num}) = {gamma(num)}''')
		print("\nEnter 0 to exit...")







from __future__ import annotations





def 					lowercase_ (    __snake_case     :							list      )     -> float:





				'''simple docstring'''


				if not nums:
								raise ValueError("List is empty"      )
				return sum(__snake_case      ) / len(__snake_case      )


if __name__ == "__main__":
	import doctest

	doctest.testmod()