



"""simple docstring"""






import math

import numpy as np
import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute


def 			_lowercase				(  __snake_case = 3	)						->   qiskit.result.counts.Counts:
			if isinstance(__snake_case					,__snake_case	):
						raise TypeError("number of qubits must be a integer."	)
			if number_of_qubits <= 0:
						raise ValueError("number of qubits must be > 0."	)
			if math.floor(__snake_case	) != number_of_qubits:
						raise ValueError("number of qubits must be exact integer."	)
			if number_of_qubits > 10:
						raise ValueError("number of qubits too large to simulate(>10)."	)

			__lowerCAmelCase      :  Any												=       QuantumRegister(__snake_case					,"qr"	)
			__lowerCAmelCase      :  List[str]												=       ClassicalRegister(__snake_case					,"cr"	)

			__lowerCAmelCase      :  List[str]												=       QuantumCircuit(__snake_case					,__snake_case	)

			__lowerCAmelCase      :  str												=       number_of_qubits

			for i in range(__snake_case	):
						quantum_circuit.h(number_of_qubits - i - 1	)
						counter -= 1
						for j in range(__snake_case	):
									quantum_circuit.cp(np.pi / 2 ** (counter - j)					,__snake_case					,__snake_case	)

			for k in range(number_of_qubits // 2	):
						quantum_circuit.swap(__snake_case					,number_of_qubits - k - 1	)

			# measure all the qubits
			quantum_circuit.measure(__snake_case					,__snake_case	)
			# simulate with 10000 shots
			__lowerCAmelCase      :  List[str]												=       Aer.get_backend("qasm_simulator"	)
			__lowerCAmelCase      :  Union[str, Any]												=       execute(__snake_case					,__snake_case					,shots=10_000	)

			return job.result().get_counts(__snake_case	)


if __name__ == "__main__":
	print(
	    F"""Total count for quantum fourier transform state is: \
    {quantum_fourier_transform(3)}"""
	)




"""simple docstring"""






def 			_lowercase				(  __snake_case					,__snake_case	)						->   float:
			if digit_amount > 0:
						return round(number - int(__snake_case	)					,__snake_case	)
			return number - int(__snake_case	)


if __name__ == "__main__":
	print(decimal_isolate(1.53, 0))
	print(decimal_isolate(35.345, 1))
	print(decimal_isolate(35.345, 2))
	print(decimal_isolate(35.345, 3))
	print(decimal_isolate(-14.789, 3))
	print(decimal_isolate(0, 2))
	print(decimal_isolate(-14.123, 1))
	print(decimal_isolate(-14.123, 2))
	print(decimal_isolate(-14.123, 3))