Monday, March 30, 2015

Exponents In Python - Python Numbers - Python Tutorial

Exponents in PythonExponents In Python


In this Python Tutorial, we are going to look at exponents in Python. We first need to realise what an exponent is. An exponent is the power to which a number is raised. For example 2 * 2 * 2 is equivalent to 8. With an exponent, we can cut down on writing the whole equation out and use **(exponent in Python) by using this operator we are doing the equation in shorthand. Example of exponent 2 ** 3 is equal to 8.  Less typing the same outcome.


Examples Exponents In Python


We will perform all these examples in our Python interpreter. Make sure you follow a long and do some of your own. The best way to learn Python is by practicing.


#Examples of Exponents In Python

>>> 2 ** 4
16

>>> 78 ** 97
3413315720704337419097101027000771686980504078677575730926905758203118108388932801027381449501146100963728165489443041132814728861531870470672271776414594578193877674244432184882495488

>>> 5 ** 5
3125

>>> 4 ** 2
16

>>> 9 ** 7
4782969

>>> 7.5 ** 4
3164.0625

As you can see there is not much to exponents in Python. Since exponents are pretty simple to work with there is not much to this Python tutorial. Just remember that exponents are available to you and the syntax and you will be all ready to go.



No comments:

Post a Comment