How to Square A Number in Python

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. In…

The post How to Square A Number in Python appeared first on CodeSource.io.


This content originally appeared on CodeSource.io and was authored 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.

The post How to Square A Number in Python appeared first on CodeSource.io.


This content originally appeared on CodeSource.io and was authored by Ariessa Norramli


Print Share Comment Cite Upload Translate Updates
APA

Ariessa Norramli | Sciencx (2021-02-23T11:57:52+00:00) How to Square A Number in Python. Retrieved from https://www.scien.cx/2021/02/23/how-to-square-a-number-in-python/

MLA
" » How to Square A Number in Python." Ariessa Norramli | Sciencx - Tuesday February 23, 2021, https://www.scien.cx/2021/02/23/how-to-square-a-number-in-python/
HARVARD
Ariessa Norramli | Sciencx Tuesday February 23, 2021 » How to Square A Number in Python., viewed ,<https://www.scien.cx/2021/02/23/how-to-square-a-number-in-python/>
VANCOUVER
Ariessa Norramli | Sciencx - » How to Square A Number in Python. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/02/23/how-to-square-a-number-in-python/
CHICAGO
" » How to Square A Number in Python." Ariessa Norramli | Sciencx - Accessed . https://www.scien.cx/2021/02/23/how-to-square-a-number-in-python/
IEEE
" » How to Square A Number in Python." Ariessa Norramli | Sciencx [Online]. Available: https://www.scien.cx/2021/02/23/how-to-square-a-number-in-python/. [Accessed: ]
rf:citation
» How to Square A Number in Python | Ariessa Norramli | Sciencx | https://www.scien.cx/2021/02/23/how-to-square-a-number-in-python/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.