
"""simple docstring"""



import math

import numpy as np
import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute
def 					_UpperCAmelCase      ( __lowerCamelCase   :       Optional[Any] = 3		)     ->					int:
  if isinstance(__SCREAMING_SNAKE_CASE ,					__SCREAMING_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(__SCREAMING_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).'''		)

  _snake_case					     =       QuantumRegister(__SCREAMING_SNAKE_CASE ,					'''qr'''		)
  _snake_case					     =       ClassicalRegister(__SCREAMING_SNAKE_CASE ,					'''cr'''		)

  _snake_case					     =       QuantumCircuit(__SCREAMING_SNAKE_CASE ,					__SCREAMING_SNAKE_CASE		)

  _snake_case					     =       number_of_qubits

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

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

  # measure all the qubits
  quantum_circuit.measure(__SCREAMING_SNAKE_CASE ,					__SCREAMING_SNAKE_CASE		)
  # simulate with 10000 shots
  _snake_case					     =       Aer.get_backend('''qasm_simulator'''		)
  _snake_case					     =       execute(__SCREAMING_SNAKE_CASE ,					__SCREAMING_SNAKE_CASE ,					shots=1_00_00		)

  return job.result().get_counts(__SCREAMING_SNAKE_CASE		)


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





import pprint

import requests

UpperCAmelCase	      = '''https://zenquotes.io/api'''






def 							UpperCAmelCase_		(							):
	return requests.get(API_ENDPOINT_URL + '/today'							).json()






def 							UpperCAmelCase_		(							):
	return requests.get(API_ENDPOINT_URL + '/random'							).json()


if __name__ == "__main__":
	UpperCAmelCase	      = random_quotes()
	pprint.pprint(response)

