def __mul__(self, a):
    'The scalar multiplication operation between a scalar and an Observable/Tensor.'
    if isinstance(a, (int, float)):
        return qml.Hamiltonian([a], [self], simplify=True)
    raise ValueError(f'Cannot multiply Observable by {type(a)}')
The scalar multiplication operation between a scalar and an Observable/Tensor.
def __mul__(self, a):
    
    if isinstance(a, (int, float)):
        return qml.Hamiltonian([a], [self], simplify=True)
    raise ValueError(f'Cannot multiply Observable by {type(a)}')