## #4 Python Glossary: Operator

Operators in python

There are various operators in python.

- Arithmetic operator
- comparison/ relational operator
- assignment operator
- logical operator
- membership operator
- Identity operator
- presedence operator

## Arithmetic Operator

```
>>> #this is addition or plus
>>> 3+5
8
```

```
>>> #this is substraction or minus
>>> 10 - 3
7
```

```
>>> #this is multiply two operand (value or variable) either side of the operator
>>> 4 * 5
20
```

```
>>> #division divide first operand by second operand
>>> 10 / 2
5
```

```
>>> # modulus divides and returns the value of the remainder.
>>> 10%3
1
```

## Comparison/ Relational Operator

Comparison/ relational operators compare the values on two sides of the value or variable. For example, 4 < 2 (output = False). After we write a comparison between value /variable/operand, then Python program in run mode will tell whether an operand is greater than the other, lesser, equal, or a combination of those. Various comparison operators are ( ==, != , <>, >,<=, etc)

```
>>> #Equal to (==) check whether first operand equal to the second
>>> 5 == 5
True
>>> x = 10
>>> x == 11
False
```

```
>>> # Not equal to (!=) will check whether first is not equal to the second
>>> 3 != 1
True
>>> 5 != 5
False
```

## Assignment Operator

Assignment operators in Python assign the value to a variable. Assign variable that already has value to a variable is allowed. But we can not assign a

## Logical Operator

Logical operators consist 3 operator: or, and, not. That are used for combined conditional statements are true or false. The ‘and’ operator return to True only if two side are True. The ‘or’ operator return to True if one or two side are True. The ‘not’ for True is False. The ‘not’ for False is True.

## Membership Operator

Membership operator check whether some value is membership of lists. There are two membership operator in Python: ‘in’ and ‘not in’

## Identity Operator

Identity operator

## Precedence operator

Precedence operator avoids ambiguity. It determines which operators need to be evaluated first. Precedence operator consists of parenthesis or (). Then