Wednesday, July 27, 2016

Python tutorial:Doing math with the interactive shell

python programming tutorial math operators
Python tutorial


Python tutorial: First steps with python


Hello friend, welcome to another python tutorial, this time you will make your first steps with python, and you will learn about math operators,
in this tutorial we will work with python IDLE, so let us start
first here are Math Operators:
python programming tutorial  math operators
math operators


Math with python: addition, subtraction, multiplication and division

python IDLE can be a calculator, so enter the following expressions into the interactive shell to see for yourself:
python programming tutorial math interactive shell
math with interactive shell


as you see the interactive shell is a calculator  ^_^ , even if we give it a complicated expression it will calculate it , let us try:
python programming tutorial math interactive shell
complicated math expression for interactive shell


now let us take a look on other operators:
**          exponent
%           Modulus/remainder
//             integer division

to understand each one of them we use examples,

Exponent:

           a**b = a*a*a*...... b time
           3**4 = 3*3*3*3    four times

python programming tutorial exponent interactive shell
exponent


Modulus:

          a%b = the rest of division a/b
          16%7 =2    because 16 = 7 * 2 + 2
python programming tutorial modulus interactive shell
modulus


Integer division :

            a//b= the integer part of the a/b
            7//2=3  because 7/2=3.5 and the integer part is 3
python programming tutorial math integer division interactive shell
integer division


this is the end of this python tutorial, i hope that you enjoyed it and learn something new
don't forget to practice
thanks
if i missed something i will be pleased to hair from you in the comments below


1 comment:

  1. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.

    python training in bangalore|

    ReplyDelete