### Previous Lesson: *Lesson 6: If Elif Else Statements in Python*

Operators and delimiters in Python play an essential part in coding. In this lesson, we’ll see what many of them can do and how we’ll use each one of them. We’ll try all of the following examples on a new file: **ex5.py**.

Additionally, I just want you to know that this is your time to experiment whatever you’d like to experiment with each operators. So this means that you don’t have to copy everything that I do exactly. Instead, you can have your own versions.

By the way, what are **Operators **and **Delimiters **in Python? **Operators **are operations that we use in mathematics. While **Delimiters** are symbols that we use to compare two or more values. Let’s start!

## Plus/Add Operator (+)

assigns variable*Line 1***a**to a mathematical statement of addition. Thenprints the sum of that mathematical statement.*Line 16*and*Line 3*assigns a value to each variable (*Line 4***b**and**z**) and then prints out the sum of these on.*Line 17*assigns the output of*Line 18*to the*Line 17***k**variable.just adds up the value of the variables*Line 19***a**,**b**, and**z**.just adds up the value of the variables*Line 20***dad, mom, zedd,**and**maru**.- We assigned a string to each of the variables on
and*Line 13*. Then on*Line 14*, we*Line 21***added**up or united**+**).

## Minus/Subtract Operator (-)

assigns variable*Line 1***a**to a mathematical statement of subtraction. Thenprints the difference of that mathematical statement.*Line 13*and*Line 3*assigns a value to each variable (*Line 4***b**and**z**) and then prints out the difference of these on.*Line 14*assigns the output of*Line 15*to the*Line 14***k**variable.just subtracts the value of the variables*Line 16***a**,**b**, and**z**.*Line***17**just subtracts the value of the variables**dad, mom, zedd,**and**maru**.- Unlike the
**plus**(**+**), we can’t**add up**or unite both strings using the minus symbol (**–**).

## Times/Multiply Operator (*)

assigns variable*Line 1***a**to a mathematical statement of multiplication. Thenprints the product of that mathematical statement.*Line 15*and*Line 3*assigns a value to each variable (*Line 4***b**and**z**) and then prints out the product of these on.*Line 16*assigns the output of*Line 17*to the*Line 16***k**variable.just multiplies the value of the variables*Line 18***a**,**b**, and**z**.just multiplies the value of the variables*Line 20***dad, mom, zedd,**and**maru**.- We assigned a string to a variable on
. Then on*Line 13*, we*Line 20***multiplied**or repeated the same string three times over. Which means that we can repeat this as many as we want!

## Exponentiation (**)

assigns variable*Line 1***a**to a mathematical statement of exponentiation. Thenprints the result of that mathematical statement.*Line 11*and*Line 3*assigns a value to each variable (*Line 4***b**and**z**) and then prints out the result of these on.*Line 12*just exponentiates the value of the variables*Line 12***b**and**z**.assigns the output of*Line 13*to the*Line 12***k**variable.just exponentiates the value of the variables*Line 15***zedd**and**maru**.- Unlike multiplication, you
**exponentiation**or repeat a string as many as you want with******! Rather, it only works with one***.**Additionally, when you exponentiate, both should be an*int*or a variable that is equal to an integer.

## Divide (/) Operator

assigns variable*Line 1***a**to a mathematical statement of division. Thenprints the quotient of that mathematical statement.*Line 13*and*Line 3*assigns a value to each variable (*Line 4***b**and**z**) and then prints out the quotient of these on.*Line 14*assigns the quotient of*Line 15*to the*Line 14***k**variable.just divides the value of the variables*Line 16***a**,**b**, and**z**.*Line*just divides the value of the variables**17****dad, mom, zedd,**and**maru**.- You can’t divide a string as many as you want with a slash (
**/**)! Additionally, when you divide, the divisor and dividends should be an*int*or at least a variable that is equal to an integer.

## Modulo (%) Operator

- This kinda something new to our beginners. Modulo first does the operation of division, but it will not return the quotient. Instead, it will return the
*remainder.*So it’s still like operation of division. assigns variable*Line 1***a**to a mathematical statement of division. Thenprints the*Line 13**remainder*of that mathematical statement.and*Line 3*assigns a value to each variable (*Line 4***b**and**z**) and then prints out the*remainder*of these on.*Line 14*assigns the*Line 15**remainder*ofto the*Line 14***k**variable.just divides the value of the variables*Line 16***a**,**b**, and**z**.*Line*just divides the value of the variables**17****dad, mom, zedd,**and**maru**.- You can’t divide a string as many as you want with a slash (
**/**)! Additionally, when you divide, the divisor and dividends should be an*int*or at least a variable that is equal to an integer.

## Less Than (<) and Greater Than (>) Delimiters

- The results for the delimiters on the Terminal can either be TRUE or FALSE, depending on the equation trueness.
states that*Line 1***4**is less than (**<**)**6**. If this is really true, then the Terminal will say TRUE once we try to print it on*Line 14**.*and*Line 3*each assigns a value to a variable. Down to*Line 4*, these variables (*Line 15***b**and**z**) are compared. If this equation is true, then the Terminal will print TRUE; if not, FALSE. But it surely is true because**8**is really greater than**7**.has*Line 6***k**equal to**b < z**. Referencing to the values of**b**and**z**, what is the answer: TRUE or FALSE?and*Line 8*each assigns a value to a variable. Down to*Line 9*, these variables (*Line 18***mom**and**dad**) are compared. If this equation is true, then the Terminal will print TRUE; if not, FALSE.and*Line 11*each assigns a*Line 12***str**(string) to a variable. Down to, the length of these two strings are compared. If the*Line 19**length*of**code1**is really greater than**code2**, then the Terminal will print TRUE.

## Equal To (==) and Not Equal To (!=) Delimiters

- This a different example of where you can use
**==**and**!=**. But, as you can remember, on the previous lesson, we’ve talked about these conditionals. - Here,
**==**means “**equal to**“. - While the != means “
“.*not*equal to - On
, we have a pretty intermediate mathematical equation. But, as we can remember from our Math class, we can use the*Line 1**MDAS*(Multiplication, Division, Addition, Subtraction). But don’t worry; we’ll have our computer take care of this one. - On
, if*Line 3***a**is equal to**“The answer is 0”**fromprints out on the Terminal.*Line 4* - On
, if*Line 5***a**is*not*equal to**-3.5**, then**“The answer is not equal to -3.5”**fromprints.*Line 6* - On
, if*Line 7***a**is equal to**-3.5**, then**“-3.5 is the answer”**fromprints.*Line 8* - If
**a**doesn’t meet the conditions, then “Dunno. Sorry.”

## greater than-equal (>=) or less than-equal (<=) delimiters

- This a different example of where you can use
**==**and**!=**. But, as you can remember, on the previous lesson, we’ve talked about these conditionals. - Here,
**==**still means “**equal to**“. - The
**>=**means “**greater than or equal to**“. - While
**<=**means “**less than or equal to**“. - On
, we have a pretty intermediate mathematical equation. But, as we can remember from our Math class, we can use the*Line 1**MDAS*(Multiplication, Division, Addition, Subtraction). But don’t worry; we’ll have our computer take care of this one. - On
, if*Line 3***a**is equal to 0, then**“The answer is 0”**fromprints out on the Terminal.*Line 4* - On
, if*Line 5***a**is greater than or equal to 0,**“The answer is higher than or equal to 0”**fromprints. So whether the answer for our equation (in*Line 6*) is greater than 0, or the answer is equal to 0 (put simply, if the answer is 0), then the string on*Line 1*prints out.*Line 6* - On
, if*Line 7***a**is less than or equal to 0,**“The answer is lower than or equal to 0”**fromprints. So whether the answer for our equation (in*Line 8*) is less than 0, or the answer is equal to 0 (put simply, if the answer is 0), then the string on*Line 1*prints out.*Line 8* - If
**a**doesn’t meet any of these conditions, then I “Dunno. Sorry.”

## Plus-Equal (+=) and Minus-Equal (-=) Delimiters

- On
, we have the variable*Line 1***age**assigned with the value**16**. On, we are saying that whatever the value of*Line 2***age**, just add this**10**to it. So the**age**now have the value**26**. That’s what**+=**does. It’s like the shortened form of this code:**age + 10 = age**(add the value of**age**to**10**and then assign the sum to the same variable) - Same thing happens with the strings on
**name**. And for this one, the result or the value of**name**will now be:**“My name is Zedd.”**

Alright! These are just some of the many other operators and delimiters out there. But I just gave you the ones that programmers really use 90%; the others are more likely 5% used–very rare.

I’ll give you time to memorize all these. Give yourself a time to memorize these. After memorizing, write *every* operator and delimiter you’ve learned on an index card or on your notebook without looking back to this post. That way, we can remember these and use them on our daily coding when we need them.

Only once you’ve done this, can you move on to our next lesson. But I’ll tell you that I can’t stop you because I ain’t your mama. Still, do it.