This is the continuation of series of blog post on getting started to data science using python . So today will explore the building blocks of python with special emphasis on conditional flow :
Python supports the usual logical conditions from mathematics:
- Equals: a == b
- Not equals: a != b
- Less than: a < b
- Less than or equal to: a <= b
- Greater than: a > b
- Greater than or equal to: a >= b
And operator and Or operator
AND : The and keyword is a logical operator, and is used to combine conditional statements:
OR : logical operator if any one of the condition is true
Loops in python:
There are two loops in python :
While loop is the entry control loop i.e it will keep on iterate until the condition is false :
For Loops :
A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string).
** Important note :
The most important thing to remember while using for loop is to correctly go through the indentation , a wrong indentation will make the whole process faulty .
These were some of the simple example working if conditional statement and working with Loops in python .
Happy learning and sharing !!