




"""simple docstring"""




from string import ascii_uppercase







def       __UpperCAmelCase      (				__UpperCamelCase					,							__UpperCamelCase					,							__UpperCamelCase = False					,							__UpperCamelCase = ascii_uppercase					):
			__lowercase	:       List[str]				=   keyword.upper()
			__lowercase	:       Dict				=   plaintext.upper()
			__lowercase	:       Tuple				=   set(__UpperCamelCase					)

			# create a list of unique characters in the keyword - their order matters
			# it determines how we will map plaintext characters to the ciphertext
			__lowercase	:       Dict				=   []
			for char in keyword:
						if char in alphabet_set and char not in unique_chars:
									unique_chars.append(__UpperCamelCase					)
    # the number of those unique characters will determine the number of rows
			__lowercase	:       int				=   len(__UpperCamelCase					)

			# create a shifted version of the alphabet
			__lowercase	:       Union[str, Any]				=   unique_chars + [
			    char for char in alphabet if char not in unique_chars
			]

			# create a modified alphabet by splitting the shifted alphabet into rows
			__lowercase	:       Union[str, Any]				=   [
			    shifted_alphabet[k : k + num_unique_chars_in_keyword]
			    for k in range(0					,							26					,							__UpperCamelCase					)
			]

			# map the alphabet characters to the modified alphabet characters
			# going 'vertically' through the modified alphabet - consider columns first
			__lowercase	:       Any				=   {}
			__lowercase	:       Optional[int]				=   0
			for column in range(__UpperCamelCase					):
						for row in modified_alphabet:
									# if current row (the last one) is too short, break out of loop
									if len(__UpperCamelCase					) <= column:
												break

									# map current letter to letter in modified alphabet
									__lowercase	:       str				=   row[column]
									letter_index += 1

			if verbose:
						print(__UpperCamelCase					)
			# create the encrypted text by mapping the plaintext to the modified alphabet
			return "".join(mapping[char] if char in mapping else char for char in plaintext					)


if __name__ == "__main__":
			# example use
			print(mixed_keyword('college', 'UNIVERSITY'))









"""simple docstring"""




a_            =   1_0_0_0







def       __UpperCAmelCase      (				__UpperCamelCase					):
			return x * x







def       __UpperCAmelCase      (				__UpperCamelCase					,							__UpperCamelCase					,							__UpperCamelCase					,							__UpperCamelCase = 4					):
			assert callable(
			    __UpperCamelCase					), f"""the function(object) passed should be callable your input : {function}"""
			assert isinstance(__UpperCamelCase					,							(float, int)					), f"""a should be float or integer your input : {a}"""
			assert isinstance(function(__UpperCamelCase					)					,							(float, int)					), (
			    "the function should return integer or float return type of your function, "
			    f"""{type(__UpperCamelCase					)}"""
			)
			assert isinstance(__UpperCamelCase					,							(float, int)					), f"""b should be float or integer your input : {b}"""
			assert (
			    isinstance(__UpperCamelCase					,							__UpperCamelCase					) and precision > 0
			), f"""precision should be positive integer your input : {precision}"""

			# just applying the formula of simpson for approximate integration written in
			# mentioned article in first comment of this file and above this function

			__lowercase	:       Optional[Any]				=   (b - a) / N_STEPS
			__lowercase	:       Optional[int]				=   function(__UpperCamelCase					) + function(__UpperCamelCase					)

			for i in range(1					,							__UpperCamelCase					):
						__lowercase	:       Union[str, Any]				=   a + h * i
						result += function(__UpperCamelCase					) * (4 if i % 2 else 2)

			result *= h / 3
			return round(__UpperCamelCase					,							__UpperCamelCase					)


if __name__ == "__main__":
			import doctest

			doctest.testmod()



