- Coding Videos/
- Python /
- Python Tutorial #2 For Beginners (Declaring Integer Variables & Basic mathematical operations)

# Python Tutorial #2 For Beginners (Declaring Integer Variables & Basic mathematical operations)

### Download Video link >

Python Tutorial #2 For Beginners (Declaring Integer Variables & Basic mathematical operations)

Learn how to declare integer variable & how to perform basic mathematical operations in Python. In the next videos, we will discuss various things like variable declarations, string operations etc.

source

### View Comments source >

### Transcript view all >

00:01 hello everyone welcome to the second

00:03 tutorial of Python programming in this

00:06 video we will discuss a lot of things

00:08 like numbers and the basic mathematical

00:10 operations in the last video we

00:13 discussed how to access the ID LD and

00:15 how to install Python

00:17 even the ideally we have pinned it on

00:20 the taskbar so we can just access it

00:22 from him just click on it

00:26 so what we are going to discuss is so if

00:50 you remember in the sea

00:51 C++ what we used to do is we used to

00:55 declare a variable first we used to

00:58 declare its laid out right then variable

01:01 and equal to some value that means the X

01:04 variable of data type integer holds the

01:07 value 3 and we used to enter so what

01:12 happens is that you cannot use it into

01:15 the Python in the Python you don't need

01:17 to declare the datatype what you can do

01:20 instead is that you can just declare it

01:22 like this

01:22 X equal to 3 and then you can print X

01:27 when you do the assignment like X equal

01:31 to 3 the Python already comes to know

01:33 that X is having a value of integer and

01:37 we don't have to specify it otherwise so

01:41 imagine that I am putting it at like

01:43 this X equal to y equal to 5 point 4 now

01:47 this is a 4 this is a suit and I can

01:49 just do it like this print bye

01:52 and now I want to find what's the type

01:55 of my type right and it is showing that

02:04 type of Y is true now just take it for

02:07 given the X type of Tex type of X is

02:13 integer now remember you can find the

02:18 data type of any integer on any string

02:21 or anything

02:21 by using this operator type and then you

02:25 can in the parenthesis or in the opening

02:27 and closing bracket you have to specify

02:29 the type or the variable was datatype

02:34 you need to find so let's move on

02:36 towards the

02:40 mathematical operations so imagine it is

02:42 like first-edition 3 plus 5 equal to 8

02:47 then subtraction 9 minus 3 6

02:53 multiplication 6 into 3 18 division 23

02:59 divided by 3 seven point six six six six

03:02 six and then at the end seven many times

03:06 what we needed is we don't want the

03:09 decimal part what we need is the whole

03:11 number so what we can do in this case is

03:14 you can just use the division symbol two

03:18 times and will give you the whole number

03:21 and many times what happens is we don't

03:24 even want division what we need is the

03:27 remainder or the leftover so in that

03:29 case you can use this modulus operator

03:35 this operator will give you the

03:37 remainder like three sevens are 21 23 -

03:41 24 equal to 2 now imagine that I want to

03:44 do it like this 3 into 3 plus 5 into 4

03:49 so

03:51 answer should be maybe three plus pi

03:53 equal to egg and gate into four equal to

03:56 32 let's just check the answer is 23 why

04:01 is it like this first in Amy C C++ Java

04:05 or Python in all these programming

04:08 languages there are preferences given so

04:11 the first preference is always given to

04:12 the brackets then multiplication and

04:15 division then to the plus or minus so in

04:18 this case what happens is the multi

04:20 first multiplication is done 504 equal

04:23 to 20 plus 320 see so imagine that I

04:28 don't want multiplication to be taken

04:30 plus first what I want is first I want

04:34 three plus five to be done and then to

04:38 multiply it by four so for that what we

04:41 can do is 3 plus 5 into 4 so now first

04:47 the bracket will be solved and then the

04:50 whole calculation the answer will be

04:52 multiplied by phone let's just check the

04:55 answer is 32 3 plus 5 equal to 8 8 into

04:58 4 equal to 32 now there is also one

05:01 thing that we often need is to find cube

05:05 or the fourth power of something or

05:07 power or something let's imagine I have

05:09 4 and I want to find the fourth power of

05:12 it or fill power of it what would you do

05:15 you will multiply the full 5 times 4

05:18 into 4 into 4 into 4 into 4 5 times and

05:20 you will get the answer but imagine that

05:24 you have like full to the power 20 or 30

05:27 it would be time-consuming and also this

05:30 it will need a lot of space a lot of

05:32 time so what we can do instead is 4 into

05:36 2 & 5 so here this symbol this

05:41 multiplication symbol 2 x is the Wraiths

05:44 to symbol and this will give us the

05:46 answer same as the above

05:48 now if matching that I did here the

05:52 assignment operator I assign the value 3

05:55 to the X let's just try something new

05:59 imagine that there is a

06:04 but Apple which holds the value 10

06:07 rupees then there is poor hip which hold

06:11 the value again 10 rupees and there is

06:14 mister which holds a value 40 rupees

06:20 now imagine for those who don't know

06:23 where Apple okay and missile these are

06:25 the MA - reinforce so imagine you are a

06:29 few friends and you have went into the

06:30 restaurant

06:31 and you need to calculate the bill so

06:34 let's just imagine that three of your

06:37 friends

06:37 pref point but up out then four of your

06:42 friends took oh hey and three of your

06:48 friends took missile and now you want to

06:53 calculate the bill so what would Bill be

06:58 so the calculation is that the value of

07:01 this equation or the calculation then

07:04 the answer is stored into the variable

07:07 bill and now we want to access if you

07:10 want to print it so just print and then

07:12 bill so 190 so 190 is your total bill

07:18 and you have to pay it this is all for

07:21 today's video I hope that you liked it

07:24 and hope you like this video and if you

07:27 liked it please click on the like button

07:28 and please click on the subscribe button

07:30 if you want to watch the new videos that

07:33 are going to come soon and thank you for

07:36 watching till the next video adios

## Leave a Reply