How to Square A Number in Python
Posted on: February 23, 2021 by Ariessa Norramli
In this article, you will learn how to square a number in Python.
Let’s say you have an integer named ‘a’ with value 22.
a = 22
In order to calculate the square of a number, you can use the pow()
method.
a = 22
print(pow(a, 2))
# => 484
Note: The pow()
method functions by raising the first argument to the power of the second argument.
Share on social media
//