Skip to content

Files

Latest commit

906957e · May 24, 2017

History

History
22 lines (20 loc) · 912 Bytes

File metadata and controls

22 lines (20 loc) · 912 Bytes

Python Exponents

Python uses the double asterisk (**) operator to handle exponentiation.
The number before the asterisks is the base, and the number after is the exponent.
Python also lets you use the built-in function pow(x, y), which gives you x to the power of y.

>>> 2 ** 2
4
>>> pow(2, 4)
16
>>> pow(2.0, 4)
16.0

Instructions:
In the console, you are given two variables, a and b.
Using either method described in this lesson, define a variable named power that equals a to the power of b.