Simple Calculation using Python Programming Language

Simple Calculation using Python Programming Language


hi guys, today I’m going to present you
our third lesson of Python programming language our class will be about simple
calculation using Python programming language before I’m going to start my
class our class I would like to tell you that in Python programming language plus represents addition and – represents subtraction and forward slash represents
division and asterisk represents the multiplication so lets us you know give
you the example of all of that so first we go to the visual studio code okay
in our last class we have already you know created the Python course folder and
inside the Python course folder we have put the file Python file project 1 so let us
continue to you know creating our Python files and put it inside our Python
course folder to do that is simple just we click on the Python course and just
new file just my name it Python sorry project 2 dot py and we click enter
don’t forget to put py ok so lets us to start to write our code here we have the
file we just we have the first variable like for example give 2 the second
variable y is equal 4 the third value variable is Z is equal for example 8 so
let’s to give the our first example of of addition so we use a print function
here too to make to make it appear in the our
output so just write x plus y is the first function. in the second
function we we use a subtraction here Y minus X okay. the third the third
function we use like we’ll use division here
so print Z divided by for example Y okay
the last one we use multiplication X multiplied by z okay so we have you
know we just give like for example of the addition the subtraction sorry the
first example is about the addition the second example is of the subtraction. the
third example is of the division and the last one example of multiplication let’s
to execute my code simply just click on the right button and we choose after
that run Python file in terminal. see it works so X plus y equals 6.y minus X
equals 2 and Z divided by Y equals 2 point 0 .why 2 point 0 here
of course I have just told you why is 2 point 0 this means this the number is decimal
this means is decimal this means the number has point so why and why
after after I divided z by y the number became decimal here
because here in my in Python programming language I have a rule that whenever I
divide any number in python programming language the result will be float this
means will be decimal this means will be will be
will have a point okay okay the the last example is X multiplies it
X multiplies it is 16 X 2 and Z is 8 so this mean will become you know 16 okay
so let’s give another another example just right you know create another
project project 3 for example project 3 dot py I click enter here that’s 2 for
example to copy here okay we copy and we put it in project 3 ok ok so now I will
use the function print but inside the function print inside the parentheses I
will use all the operators like + – division and multiplication so all the
operators I will use so let’s do to start to write print here we have for example
X plus parentheses open parentheses and close parentheses and then inside it
I will put z multiply for example Y and outside parentheses I will use you
know division here just for example write X divided by X ok so in Python we have a you know we have a
rule that the calculation always will start inside
the parentheses inside here in our case with the calculation will start first in
z multiply y okay and in our case so the because you know thou always the
calculation was supposed to be started inside the parentheses so the calculation
who starts it multiply why after the the result of this calculation you know we
divided by X after divided by X the result of whole you know all whole the
calculation of open parentheses z multiply Y close parentheses divided by
X will be you know will be added with X okay
with the x so let’s now to to execute my code the project 3 run Python
file in terminal ok 18.0 why is float again because we use division so
correctly correct is 18 so everything now is fine okay okay thank you very
much this is the end of our video of the of all the third lesson see you on the
next video thank you very much

One thought to “Simple Calculation using Python Programming Language”

Leave a Reply

Your email address will not be published. Required fields are marked *