PYTHON- Variables, Expression, and Functions:

In python for data science, there is interpator and not any compiler. Let’s start by creating a program. Here, we are using python 2.7.

Creating a Python File:

Python uses the extension “.py”. First, open the text editor and save a file with any name you like. We have taken the file name “”. Open the file and write the following codes.

print “hello world”

# No semi colon will be used.

Reading Contents of File:

In the case of a Linux system, go to directory from the terminal where the file is ( with the help of ‘cd’ command and then type “python”.

For Windows system, first, open command prompt and type ‘cd’ command to move to the directory the file is stored. Then write file name as command.


Variables are directly usable i.e. declaration of variables are not required. These are case sensitive too.

Variables, Expression and Functions in Python for Data Science - PST


We use arithmetic operators to apply arithmetic functions. Some of them are in-built.

Conditions in Python:

elif and if-else statements are there to obtain conditional output in Python language.

Variables, Expression and Functions in Python for Data Science - PST

Functions in Python Language for Data Science:

The keyword ‘def’ there to define a function by putting it before the name of the function. Explicit specificity of the return type of functions in Python is not necessary. For invoking a function, we need to write the function name followed by the parameter list in brackets.


So, to learn more about it in python for data science, you can check this and this.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.