# Day 3: Python Newbie?

Operators are used to perform operations on variables and values.

• Arithmetic operators
• Assignment operators
• Comparison operators
• Logical operators
• Identity operators
• Membership operators

## Arithmetic Operators:

`var1 = 20var2 = 5res_add=var1 + var2 #Addition among variablesres_sub=var1 - var2 #Subtraction among variablesres_mul=var * var2 #multiplication among variablesres_div=var / var2 #division among variablesres_mod=var % var2 #modulus among variablesres_mul=var // var2 #floor division among variables`

## Assignment operators:

`var1 = 20var1 += 5var1 -= 2`

## Comparison operators:

`var1 = 5var2 = (2+3)Equal_to = (var1 == var2) #Truegreater_then =(var1 > var2) #Falsegreater_then_equal_to = (var1 >= var2)#True`

## Logical operators:

`var1 = 15var2 = 25result1= (var1 > 10 and var2 < 30) #Trueresult2= (var1 >5 or var2 < 20)#Trueresult3= not(Var > 5 and var2 < 30 ) #False`

## Identity operators:

• Operator is: It returns true if two variables point the same object and false otherwise
• Operator is not: It returns false if two variables point the same object and true otherwise
`var1=[1,2,3]var2=[1,2,3]var3=var1print(var3 is var1) #Trueprint(var3 is var2) #False`

## Membership operators:

`list1 = ["one","two","three"]print("one" in list1)#Trueprint("Five" in list1) #False`

--

--

--

Data Scientist who loves to teach machine through data.

Love podcasts or audiobooks? Learn on the go with our new app. Data Scientist who loves to teach machine through data.

## Hands on Python programming;  