






import qiskit







def 	_UpperCamelCase   (    UpperCamelCase_       :					int    ,       UpperCamelCase_       :					int		)  ->   qiskit.result.counts.Counts:

						"""simple docstring"""



						lowerCAmelCase__    						=						qiskit.Aer.get_backend('aer_simulator'		)

						lowerCAmelCase__    						=						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
						lowerCAmelCase__    						=						qiskit.execute(UpperCamelCase_    ,       UpperCamelCase_    ,       shots=1000		)

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


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













def 	_UpperCamelCase   (    UpperCamelCase_       :					int		)  ->   int:

						"""simple docstring"""



						if not isinstance(UpperCamelCase_    ,       UpperCamelCase_		):
												raise ValueError('multiplicative_persistence() only accepts integral values'		)
						if num < 0:
												raise ValueError('multiplicative_persistence() does not accept negative values'		)

						lowerCAmelCase__    						=						0
						lowerCAmelCase__    						=						str(UpperCamelCase_		)

						while len(UpperCamelCase_		) != 1:
												lowerCAmelCase__    						=						[int(UpperCamelCase_		) for i in num_string]

												lowerCAmelCase__    						=						1
												for i in range(0    ,       len(UpperCamelCase_		)		):
																		total *= numbers[i]

												lowerCAmelCase__    						=						str(UpperCamelCase_		)

												steps += 1
						return steps







def 	_UpperCamelCase   (    UpperCamelCase_       :					int		)  ->   int:

						"""simple docstring"""



						if not isinstance(UpperCamelCase_    ,       UpperCamelCase_		):
												raise ValueError('additive_persistence() only accepts integral values'		)
						if num < 0:
												raise ValueError('additive_persistence() does not accept negative values'		)

						lowerCAmelCase__    						=						0
						lowerCAmelCase__    						=						str(UpperCamelCase_		)

						while len(UpperCamelCase_		) != 1:
												lowerCAmelCase__    						=						[int(UpperCamelCase_		) for i in num_string]

												lowerCAmelCase__    						=						0
												for i in range(0    ,       len(UpperCamelCase_		)		):
																		total += numbers[i]

												lowerCAmelCase__    						=						str(UpperCamelCase_		)

												steps += 1
						return steps


if __name__ == "__main__":
					import doctest

					doctest.testmod()





