





'''simple docstring'''






from PIL import Image






def      __A						(							a_						:  Image	):
		lowerCAmelCase	,		lowerCAmelCase     :    List[Any]						=   image.size
		lowerCAmelCase     :    str						=   0
		lowerCAmelCase     :    Dict						=   image.load()
		for i in range(a_	):
				for j in range(a_	):
						lowerCAmelCase     :    str						=   pixels[j, i]
						mean += pixel
		mean //= width * height

		for j in range(a_	):
				for i in range(a_	):
						lowerCAmelCase     :    Optional[int]						=   2_5_5 if pixels[i, j] > mean else 0
		return image


if __name__ == "__main__":
					lowerCAmelCase       		=      mean_threshold(Image.open("""path_to_image""").convert("""L"""))
					image.save("""output_image_path""")










'''simple docstring'''






def      __A						(							a_						:  int	):
		assert (
		    isinstance(a_      ,a_	) and number_of_steps > 0
		), f'''number_of_steps needs to be positive integer, your input {number_of_steps}'''
		if number_of_steps == 1:
				return 1
		lowerCAmelCase	,		lowerCAmelCase     :    int						=   1, 1
		for _ in range(number_of_steps - 1	):
				lowerCAmelCase	,		lowerCAmelCase     :    Union[str, Any]						=   current + previous, current
		return current


if __name__ == "__main__":
					import doctest

					doctest.testmod()



