
"""simple docstring"""


import qiskit






def       _snake_case				(		snake_case__   :     int	,      snake_case__   :     int     ):
	A						   =   qiskit.Aer.get_backend('aer_simulator'     )

	A						   =   qiskit.QuantumCircuit(4	,      2     )
	# encode inputs in qubits 0 and 1
	if bita == 1:
		qc_ha.x(0     )
	if bita == 1:
		qc_ha.x(1     )
	qc_ha.barrier()

	# use cnots to write XOR of the inputs on qubit2
	qc_ha.cx(0	,      2     )
	qc_ha.cx(1	,      2     )

	# use ccx / toffoli gate to write AND of the inputs on qubit3
	qc_ha.ccx(0	,      1	,      3     )
	qc_ha.barrier()

	# extract outputs
	qc_ha.measure(2	,      0     )  # extract XOR value
	qc_ha.measure(3	,      1     )  # extract AND value

	# Execute the circuit on the qasm simulator
	A						   =   qiskit.execute(snake_case__	,      snake_case__	,      shots=1000     )

	# Return the histogram data of the results of the experiment
	return job.result().get_counts(snake_case__     )


if __name__ == "__main__":
		_lowercase							   =				half_adder(1, 1)
		print(F"""Half Adder Output Qubit Counts: {counts}""")

"""simple docstring"""


from math import pi, sqrt






def       _snake_case				(		snake_case__   :     float     ):
	if num <= 0:
		raise ValueError('math domain error'     )
	if num > 171.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       _snake_case				(		):
	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()
		_lowercase							   =				1.0
		while num:
				_lowercase							   =				float(input('''Gamma of: '''))
				print(F"""gamma({num}) = {gamma(num)}""")
				print('''\nEnter 0 to exit...''')