1 00:00:02,110 --> 00:00:10,030 In Python they don't have to declare these types of debatable ahead of time like we do in DC. 2 00:00:10,030 --> 00:00:20,850 Language the interpreter automatically detects the type of the variable by the data it contains in order 3 00:00:20,850 --> 00:00:31,470 to assign a value to a variable B use d equals sign here which is known as the assignment operator and 4 00:00:31,470 --> 00:00:39,710 if you try to access a variable that has not been assigned a value the program draws an error. 5 00:00:39,840 --> 00:00:44,820 So let's see this in the python share here in the python shell. 6 00:00:45,210 --> 00:00:54,030 I will try to squirt a ready bill that has not been assigned a value and see what is going to happen 7 00:00:54,030 --> 00:00:54,610 here. 8 00:00:54,660 --> 00:01:07,460 So I would say X days to the power all two and then hit enter so the program has thrown an error saying 9 00:01:07,460 --> 00:01:09,540 name X is non defined. 10 00:01:09,680 --> 00:01:18,580 So this means Python encounters a name or a variable that it does not recognize and this is the reason 11 00:01:18,590 --> 00:01:26,530 we get the name error the next topic that we want to discuss is simultaneous assignment. 12 00:01:26,540 --> 00:01:35,990 Python allows simultaneous assignments and the syntax is something like this and this statement dated 13 00:01:36,160 --> 00:01:45,020 Python to evaluate all of the expressions on the right hand side and then assign them to the corresponding 14 00:01:45,020 --> 00:01:47,210 variables on the left. 15 00:01:47,300 --> 00:01:52,780 So let us now see an example in the python shell. 16 00:01:53,330 --> 00:02:04,530 Let us now define two variables x and y so X comma Y equal to four. 17 00:02:05,010 --> 00:02:08,000 Fine hit in dirt. 18 00:02:08,050 --> 00:02:20,450 Now let's see what value the red X contains more than Y is five and simultaneous assignments odd helpful 19 00:02:20,450 --> 00:02:23,850 to swap y lose all two variables. 20 00:02:23,930 --> 00:02:31,640 Say for example if we want to swap the values into variables x and y you could do something like this. 21 00:02:31,780 --> 00:02:33,590 Get them to put on a T. 22 00:02:33,590 --> 00:02:38,950 What value does X contain X has five. 23 00:02:39,000 --> 00:02:43,050 What would y y contains for. 24 00:02:43,910 --> 00:02:53,290 Yeah do the arithmetic operators that we use in python like addition subtraction multiplication modulo 25 00:02:53,320 --> 00:03:02,690 exponent flawed division set of if you try to divide number by 0. 26 00:03:02,790 --> 00:03:13,800 Python raises and edit and the script is interrupted so let's say we try to do Y number 20 by 0. 27 00:03:13,920 --> 00:03:24,110 As you can see here Python has raised and added zero division it has raised instead of just showing 28 00:03:24,110 --> 00:03:33,200 the message exception needed Python dictated what type of exception it was encountered in our case it 29 00:03:33,200 --> 00:03:34,330 is zero division. 30 00:03:34,410 --> 00:03:43,460 Edit and Python comes with wedges built and exceptions as well as the possibility to create self defined 31 00:03:43,550 --> 00:03:44,870 exceptions. 32 00:03:44,870 --> 00:03:51,920 Until now we have discussed about various arithmetic operators such as addition subtraction division 33 00:03:51,980 --> 00:03:54,340 flawed division etc.. 34 00:03:54,410 --> 00:03:56,150 That is not the. 35 00:03:56,300 --> 00:04:04,100 Arithmetic operator that which is known as the modulo operator and suppose you want to find the remainder 36 00:04:04,130 --> 00:04:08,430 then using division you can use the modulo operator. 37 00:04:08,600 --> 00:04:16,430 Say for example you want to divide the number nine by two. 38 00:04:16,510 --> 00:04:22,510 If you use the division operator you get the quotient. 39 00:04:22,590 --> 00:04:33,870 If you want to know the remainder use the modulo operator and the symbol for this is percentage sign. 40 00:04:33,960 --> 00:04:44,760 So 1 is the remainder when you divide 9 by 2 13 modulo offering 2 3. 41 00:04:46,810 --> 00:04:52,720 So here you get the domain to then using the modulo operator.