Operators in sage notebook vs importing from Python
Question: Operators behave differently depending on how I run my sage program. in the
notebook:

    
    
    2^10 
    ==>1024
    

running my program with `sage -python filename.py`:

    
    
    from sage.all import *
    print(2^10)
    ==> 8
    

What do I have to import in Python to replicate the behaviour of the Sage
notebook?

Edit:

Thanks everyone for the basic Python lessons. DSM answered this question in
the comments, turns out sage notebook has a preprocessor.


Answer: In python for `Exponentiation` we use double asterik `**`

    
    
    >>> print (2**10)
    1024
    

OR you can use built-in function **pow**.

    
    
    >>> pow(2, 10)
    1024
    

**_pow_**

    
    
    pow(...)
        pow(x, y[, z]) -> number
    
        With two arguments, equivalent to x**y.  With three arguments,
        equivalent to (x**y) % z, but may be more efficient (e.g. for longs).
    enter code here
    

* * *

`^` is a bitwise operator for performing XOR(`bitwise exclusive or`)
operation.

### _For example_ :

    
    
    >>> a = [1,2,3]
    >>> b = [3,4,5]
    >>> a^b
    >>> set(a)^set(b)
    set([1, 2, 4, 5])
    

**_[x ^ y](https://wiki.python.org/moin/BitwiseOperators)_**

    
    
    Does a "bitwise exclusive or". 
    Each bit of the output is the same as the corresponding bit in x if that bit in y is 0, 
    and it's the complement of the bit in x if that bit in y is 1.
    
    Just remember about that infinite series of 1 bits in a negative number, and these 
    should all make sense.
    

  * **[You can find great explanation about Bitwise operation over here](http://stackoverflow.com/questions/1746613/bitwise-operation-and-usage)**

