from qiskit import QuantumCircuit,QuantumRegister,ClassicalRegister

# If the name is not given, default name is taken
q=QuantumRegister(2)
q

# We can also give the name to the quantum register
q=QuantumRegister(2,'qr')
q

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

q=QuantumRegister(2,'qr')
c=ClassicalRegister(2,'cr')
qc=QuantumCircuit(q,c)


qc=QuantumCircuit(QuantumRegister(2,'qr'),ClassicalRegister(2,'cr'))

qc=QuantumCircuit(QuantumRegister(2,'qr'))

qc=QuantumCircuit(QuantumRegister(2))

qc=QuantumCircuit(QuantumRegister(2),ClassicalRegister(2))

qc=QuantumCircuit(2)

qc=QuantumCircuit(2,2)

qc

# In this example, we have given registers name

qc=QuantumCircuit(QuantumRegister(2,'qr'),ClassicalRegister(2,'cr'))
qc.draw(output="mpl")

print(qc.qubits) 

print(qc.clbits) 

# In this example, we have NOT given registers name

qc=QuantumCircuit(2,2)
qc.draw(output="mpl")

print(qc.qubits)

print(qc.clbits)

qc.qregs

qc.cregs

qc.num_qubits

qc.num_clbits

qc.clbits

qc.qubits

qc.width()  #total number of qubits and classical bits