Hey @ankit27kh! Yes, there are two ways of doing this
Method 1:
from pennylane.operation import Tensor
@qml.qnode(dev)
...
return qml.expval(Tensor(*[qml.PauliZ(i) for i in range(n_qubits)]))
Method 2:
from functools import reduce
import operator
@qml.qnode(dev)
...
obs = reduce(operator.matmul, [qml.PauliZ(i) for i in range(n_qubits)])
return qml.expval(obs)