'''simple docstring'''







from __future__ import annotations


def    lowerCamelCase       (			UpperCAmelCase__				:  float				,						UpperCAmelCase__				:  float				,						UpperCAmelCase__				:  float				,						)			->	tuple[str, float]:


							'''simple docstring'''






							if (stress, tangential_force, area).count(0		) != 1:
														raise ValueError('You cannot supply more or less than 2 values'		)
							elif stress < 0:
														raise ValueError('Stress cannot be negative'		)
							elif tangential_force < 0:
														raise ValueError('Tangential Force cannot be negative'		)
							elif area < 0:
														raise ValueError('Area cannot be negative'		)
							elif stress == 0:
														return (
														    "stress",
														    tangential_force / area,
														)
							elif tangential_force == 0:
														return (
														    "tangential_force",
														    stress * area,
														)
							else:
														return (
														    "area",
														    tangential_force / stress,
														)


if __name__ == "__main__":
		import doctest

		doctest.testmod()







'''simple docstring'''







import numpy as np
import qiskit


def    lowerCamelCase       (			UpperCAmelCase__				:  int = 8				,						UpperCAmelCase__				:  int | None = None		)			->	str:


							'''simple docstring'''






							SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = np.random.default_rng(seed=UpperCAmelCase__		)

							# Roughly 25% of the qubits will contribute to the key.
							# So we take more than we need.
							SCREAMING_SNAKE_CASE__     :Optional[int]						    = 6 * key_len
							# Measurement basis for Alice's qubits.
							SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = rng.integers(2				,						size=UpperCAmelCase__		)
							# The set of states Alice will prepare.
							SCREAMING_SNAKE_CASE__     :List[Any]						    = rng.integers(2				,						size=UpperCAmelCase__		)
							# Measurement basis for Bob's qubits.
							SCREAMING_SNAKE_CASE__     :str						    = rng.integers(2				,						size=UpperCAmelCase__		)

							# Quantum Circuit to simulate BB84
							SCREAMING_SNAKE_CASE__     :int						    = qiskit.QuantumCircuit(UpperCAmelCase__				,						name='BB84'		)

							# Alice prepares her qubits according to rules above.
							for index, _ in enumerate(UpperCAmelCase__		):
														if alice_state[index] == 1:
																					bbaa_circ.x(UpperCAmelCase__		)
														if alice_basis[index] == 1:
																					bbaa_circ.h(UpperCAmelCase__		)
							bbaa_circ.barrier()

							# Bob measures the received qubits according to rules above.
							for index, _ in enumerate(UpperCAmelCase__		):
														if bob_basis[index] == 1:
																					bbaa_circ.h(UpperCAmelCase__		)

							bbaa_circ.barrier()
							bbaa_circ.measure_all()

							# Simulate the quantum circuit.
							SCREAMING_SNAKE_CASE__     :str						    = qiskit.Aer.get_backend('aer_simulator'		)
							# We only need to run one shot because the key is unique.
							# Multiple shots will produce the same key.
							SCREAMING_SNAKE_CASE__     :int						    = qiskit.execute(UpperCAmelCase__				,						UpperCAmelCase__				,						shots=1				,						seed_simulator=UpperCAmelCase__		)
							# Returns the result of measurement.
							SCREAMING_SNAKE_CASE__     :List[Any]						    = job.result().get_counts(UpperCAmelCase__		).most_frequent()

							# Extracting the generated key from the simulation results.
							# Only keep measurement results where Alice and Bob chose the same basis.
							SCREAMING_SNAKE_CASE__     :Any						    = ''.join(
							    [
							        result_bit
							        for alice_basis_bit, bob_basis_bit, result_bit in zip(
							            UpperCAmelCase__				,						UpperCAmelCase__				,						UpperCAmelCase__		)
							        if alice_basis_bit == bob_basis_bit
							    ]		)

							# Get final key. Pad with 0 if too short, otherwise truncate.
							SCREAMING_SNAKE_CASE__     :Optional[Any]						    = gen_key[:key_len] if len(UpperCAmelCase__		) >= key_len else gen_key.ljust(UpperCAmelCase__				,						'0'		)
							return key


if __name__ == "__main__":
		print(f"The generated key is : {bbaa(8, seed=0)}")
		from doctest import testmod

		testmod()






