code: def particle_number(orbitals):
      r"""Compute the particle number observable :math:`\hat{N}=\sum_\alpha \hat{n}_\alpha`
      in the Pauli basis.
  
      The particle number operator is given by
  
      .. math::
  
          \hat{N} = \sum_\alpha \hat{c}_\alpha^\dagger \hat{c}_\alpha,
  
      where the index :math:`\alpha` runs over the basis of single-particle states
      :math:`\vert \alpha \rangle`, and the operators :math:`\hat{c}^\dagger` and :math:`\hat{c}` are
      the particle creation and annihilation operators, respectively.
  
      Args:
          orbitals (int): Number of *spin* orbitals. If an active space is defined, this is
              the number of active spin-orbitals.
  
      Returns:
          pennylane.Hamiltonian: the particle number observable
  
      Raises:
          ValueError: If orbitals is less than or equal to 0
  
      **Example**
  
      >>> orbitals = 4
      >>> print(particle_number(orbitals))
      (2.0) [I0]
      + (-0.5) [Z0]
      + (-0.5) [Z1]
      + (-0.5) [Z2]
      + (-0.5) [Z3]
      """
  
      if orbitals <= 0:
          raise ValueError(
              f"'orbitals' must be greater than 0; got for 'orbitals' {orbitals}"
          )
  
      sentence = FermiSentence(
          {
              FermiWord({(0, i): "+", (1, i): "-"}): 1.0
              for i in range(orbitals)
          }
      )
      sentence.simplify()
  
      return qubit_observable(sentence)
  
label_desc: Use image node_id 1 for calling a global function with example usage: particle_number(orbitals) and returns: qubit_observable