 Hello friends, I am Naval Yamal working as the assistant professor in mechanical engineering department Walsh and instructor of technology, Swadapur. In this video we are going to see operators used in Python. Learning outcomes. At the end of this session students will be able to understand about different operators used in Python. Content. Input function in Python. Output function. Then we are going to see what are the operators. Arithmetic operator. Relational operators. Logical operators. Bitwise operators. And assignment operators. Taking input in Python. Developers often have a need to interact with users. Either to get data or to provide some sort of result. Most programs today use a dialog box as a way of asking the user to provide some type of input. While Python provides us with inbuilt function to read input from the keyboard. So the function is input in bracket prompt. So input this function first takes the input from the user and then evaluates the expression. Which means Python automatically identifies whether user entered a string or a number or a float or a list. If the input provided is not correct then either syntax error or expectation is raised by Python. For example if I take a variable called val equal to input then enter your value printval output function. The simplest way to produce output is using print function. Where you can pass zero or more expressions separated by commas. This function converts the expression you pass into a string before writing to the screen. So for showing the output we use the function print. We will see in detail in the coming slides. So we will see what are the operators. First is arithmetic operator. Second is relation relational operators. Logical operators. Bitwise operators. And assignment operators. Arithmetic operators. So just pause the video for a few seconds and lease down the arithmetic operators you know. Okay. So let us see what are the arithmetic operators. So arithmetic operators are used to perform mathematical operations like addition, subtraction, multiplication and division. So this table shows the first column like addition plus sign. Add addition that is adds two operands. Substraction that is minus symbol. Then subtracts two operands and on the third column it is shown here the syntax. For addition it is showing suppose there are two variables x and y. We use plus sign for addition minus sign for subtraction and asterisk symbol for multiplication and a slash sign for division. And person symbol for to get the reminder. Suppose if I have two numbers and if you want to return a reminder then we use a person symbol. And power for power we are using two asterisk signs which returns the first raise to power second. So x raise to y. So for that we are using a syntax called x double asterisk y. So table one shows the arithmetic operators. So let us see a example and understand this arithmetic operators. So I have taken a variable called a equal to 9 and b equal to 4. Then I have taken one more variable add. Then I have want to do the addition of these two numbers that is a plus b and subtraction of two numbers that is a minus b. Then multiplication followed by division. Then modulus is nothing but getting a reminder when you divide 9 by 4 whatever reminder you get that is shown in the person symbol. Then we use power a double asterisk b that is a raise to b. And if you want to print or if I want to calculate this all I need to use a print function. So printing a result I get print I go for addition here then print I want subtraction print multiplication then division then print modulus and printing p. So our output will be like adding these two numbers then subtracting these two numbers. Multiplying multiplication of these two numbers division and taking the modulus that is reminder 9 divided by 4 the reminder will be 1. And the power that is 9 raised to 4 you get 6561. So this was a simple example to show you the how arithmetic operators work. Second is relational operators. Relational operators compare the values. It either returns true or false according to the condition. So this table shows you the relational operators. So there are three columns again first is symbol or operator description and the syntax. So this is greater than symbol. So here there are two variables again or we are comparing between X and Y. So if X is greater than Y it shows the output as true or it shows false. This is less than symbol and for equal to we are using equal to two times equal to equal to and for not equal to exclamation mark and equal to and greater than equal to and this symbol is for less than or equal to. So this is the syntax. So we will understand in the next slide with an example of relational operators. So here I have taken A and B, A as 13, B as 33. Then I have directly used the output function print. A is greater than B. It must show the output as false. If A is less than B, if A is equal to B, is A not equal to B, A greater than or equal to B, A less than or equal to B. So the output will show you like this is the first statement is false and second is true because A is less than B that is 13 is less than 33 you get true and A and B are not equal. It shows you false then it shows you true. You are greater than it's false and you're true. So next we'll see what is logical operators. Logical operators perform logical and logical or and logical not operations. So in this table three it shows the logical operators and we are using the operators like and or and not logical and. It shows true if both the operands are true. True if either of the operand is true logical not it shows true if operand is false. So the syntax is X and Y here X or Y and not X. So we'll understand with a simple example. A is equal to true and B equal to false. Print A and B print A or B and not A. So here A and B the result is false A or B. So any of this should be true that is true and not A. So A is already true it shows the opposite that is false. So lastly we'll see what is bitwise operators. So bitwise operator acts as on bits and perform bits by bit by bit operation. So this table shows you the bitwise operators and or not X or bitwise right shift bitwise left shift. So the syntax is X and Y X or Y not X X raised to or par Y that is used for X or an X right shift and X left shift. So bitwise is basically used to perform bit by bit operation. So here I've taken A value as 10 B value as 4 and used all the operations like and or nor X or greater than and less than. So the output for this program will be 0 14 minus 11 14 2 and 40. So these are the references I have used. Thank you.