from qiskit import QuantumCircuit,QuantumRegister,ClassicalRegister,AncillaRegister


q=QuantumRegister(2)
q=QuantumRegister(2,'qr')

c=ClassicalRegister(2)
c=ClassicalRegister(2,'cr')

qr1=QuantumRegister(2,'qr_1')
qr2=QuantumRegister(3,'qr_2')
c=ClassicalRegister(2,'cr')
qc=QuantumCircuit(qr1,qr2,c)
qc.draw(output="mpl")

qc.width()

qc.qubits

qc.num_qubits

qr1=QuantumRegister(2,'qr_1')
anc=AncillaRegister(3,'an')
c=ClassicalRegister(2,'cr')
qc=QuantumCircuit(qr1,anc,c)
qc.draw(output="mpl")

qc.width()

qc.num_qubits

qc.num_clbits

qc.qubits  # provides the information of qubits added 

qr1

anc

qc

qc=QuantumCircuit(2,2)
qc.h(0)
qc.cx(0,1)
qc.x(1)
qc.draw(output='mpl')

qc.qregs

qc.num_qubits

qc2=QuantumRegister(2)

qc.add_register(qc2)

qc.draw(output='mpl')

qc.qregs

qc.num_qubits

qr=QuantumRegister(2,'q')
cr=ClassicalRegister(2,'c')
qc=QuantumCircuit(qr,cr)
qc.h(0)
qc.x(1)
qc.draw(output="mpl")

qr

qc.qregs

qr_add=QuantumRegister(2,'qr_add')
qc.add_register(qr_add)
qc.draw(output="mpl")

qr_add

qc.qregs

cr_add=ClassicalRegister(2,'cr_add')
qc.add_register(cr_add)
qc.draw(output="mpl")

cr_add

qc.cregs

qc.measure([0,1,2,3],[0,1,2,3])
qc.draw(output="mpl")