Part 6: Working on conditional flow :

Part 6: Working on conditional flow :

This is the continuation of series of blog post on getting started to data science using python(part 1,part 2,part 3,part 4part 5) . 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

If -statement

Elifstatement :

Else Statement :

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
  • For

While loops :

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).


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 !! .

Instructor lead Online training in Datascience join our watsapp group

Upgrade your skills join our community

Leave a Reply

Close Menu