Multimatics Insight

The Best Way to Learn Python for Data Science

Learn Phyton for Data Science

In many cases, most data scientists have used Python programming language to tackle daily tasks. Python has now become the top programming language for data scientist. The simplicity in its code, its scalability, its huge supporting community, and its various libraries that heavily supports data scientists made python the ideal choice of language for data scientists. Nowadays python has become a fundamental and highly desired skill for data scientists.

The Types of Data Structure and its Processing

In order to understand the python programming language better, you should know the types of built data structures in Python that divided into ordered data structures and unordered data structures. Ordered data structures preserves the order of data in it received and consists of strings, lists, and tuples. The basic of processing ordered data structures is to know which data structures are mutable and immutable.

Strings are unchangeable or immutable and its element cannot be changed once assigned to a variable. Lists are mutable or changeable which means we can add or remove elements after assigning it to a variable. Next, tuples are immutable and usually have less functionality than lists. It allows us to store duplicate and different types of data.

Continuing with the next type of data structure, unordered data structures do not preserve the order in which we defined or entered the data. It means that the order of the data may change every time we call or use the data. Unordered data structure consists of sets and dictionaries. Sets are a group of value enclosed in curly brackets { }, they are immutable and do not permit you to store duplicate values. On the other hand, dictionaries or dict is a group of values that store data values in key:value pairs. Dicts are mutable and do not accept duplicate values.

Ways to Write Conditional Statements in Python

In real life, you will commonly assess and evaluate information around you and choose an action based on what you observe, for example: "if it is raining outside, I won’t go to the coffeeshop". In Python, there are conditional statements that can be used to perform a task when a set condition is met. These conditional statements are broken down into basic conditional statement, multiple conditional statement, and one-line conditional statement.

Basic conditional statement is the most basic type of conditional statements. In its simplest form, it looks like this:

If  <condition>:


Furthermore, you can also write multiple conditional statements by using else and elif clauses such as

name = 'erik'
if name == 'ary':
print('hai ary!')
elif name == 'erik':
print('hello erik!')
print('Who are you!?')

hello erik! 


Output: hello erik!

**Since the 'name' variable is 'erik', that’s why the first statement (e.g. ‘hai ary!’) will not be printed and will skip to the second statement. Thus, the output should be 'hello erik!'

Lastly, there is one-line conditional statement. It is similar to the previous conditional statements, but it is written in one-line. For example:

if 1 in [1,2,3]: print('1 is there!')


Output: 1 is there!

***This conditional statement type is similar to the previous ones, but written on one-line and since 1 is on the list, the output should be '1 is there!'

Get to Know the Types of Loops in Python

Loop statement is an important aspect of basic programming skills needed by every data scientist. It is used to execute an instruction repeatedly until it satisfies a certain condition or iterate over all elements of certain sequence or data. In Python, there are two types of loops, a for loop & a while loop. A for loop is used for iterating over a sequence (list, a tuple, a dictionary, a set, or a string). It performs an instruction to each element contained in the sequence, a while loop is used to repeatedly execute as long it satisfies a condition which was set.

Most of the times, you will find more complex forms of for loop and while loop such as a loop within a loop (nested loop) or a loop with conditional statements. A nested loop is a loop inside a loop. The "inner loop" will be executed one time for each iteration of the "outer loop" while a loop with a conditional statement has the potential to become an infinite loop when nothing in the loop's body can affect the outcome of the loop's conditional statement.

To overcome those more complex forms of loops, you can use loop control statements that can repeatedly execute a block of codes. Loop control statements consist of break, continue, and pass. It is important for stopping and skipping an iteration in a loop and prevents an error called infinite loops. First, Break is used to stop a looping before it meets the original condition. Then, continue is used to skip an element on a loop and lastly, pass is used when you have a loop but do not know what to put in the loop.


There are two types of built data structures in Python that divided into ordered data structures and unordered data structures. There are conditional statements in Python that can be used to perform a sort of decision-making which broken down into: basic conditional statement, multiple conditional statement, and one-line conditional statement. Lastly, there are some types of Python loops such as for loop & while loop as well as the more complex forms such as nested loop and a loop with conditional statements which are used for iteration and repeatedly executing a task.

Kodify.net. Test multiple conditions with a Python if statement: and and or explained. Retrieved January 19, 2021, from: https://kodify.net/python/if-else/if-conditions/#:~:text=To%20test%20multiple%20conditions%20in,if%20statement%20runs%20or%20not.
Sturtz, J. Conditional Statements in Python. Retrieved January 22, 2021, from: https://realpython.com/python-conditional-statements/#introduction-to-the-if-statement.
w3schools.com. Python Nested Loops. Retrieved January 18, 2021, from: https://www.w3schools.com/python/gloss_python_for_nested.asp

Share this on:

Scroll to Top