Back to Course

Introduction to Python

0% Complete
0/0 Steps
  1. Python: Basics
    14Topics
    |
    15 Quizzes
  2. Python: Control Flow
    12Topics
    |
    12 Quizzes
  3. Python: Errors
    5Topics
    |
    5 Quizzes
Lesson 1, Topic 9
In Progress

Python: Exponents

Yasin Cakal 4 Oct 2021
Lesson Progress
0% Complete

Python is also capable of performing exponentiation. A superscript number in written mathematics represents an exponent, but typing superscript numbers on modern keyboards is not always straightforward. Due to the close relationship between this operation and multiplication, we use the notation **. Here are a few examples:

# This is equivalent to 2 * 2 * 2
print(2 ** 3)

# The spaces are for clarity of the code.
print(2**3) # This does the same thing

# You can even use fractions.
# 16 to the power of 0.5 is the same as taking the square root.
print(16 ** 0.5) # Output = 4.0
%d bloggers like this: