Exponentiation using while loop in Python
Your algorithm is \$O(n)\$ where \$n = \text{degree}\$.
This means the performance of your code is quite poor.
You can make an \$O(\log(n))\$ algorithm by using binary operators on the exponent.

For an explanation of this algorithm, you:


Have the exponent in a form where you can manipulate it's binary.
Whilst the exponent isn't empty:


If the last (smallest) index of the exponent is 1, times result by the base.
Remove the last index of the exponent.
Multiply the base by it's self.



Which results in:

def pow(base, exp):
    result = 1
    while exp:
        if exp &amp; 1:
            result *= base
        exp &gt;&gt;= 1
        base *= base
    return result