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 “hello.py”. 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 (hello.py) with the help of ‘cd’ command and then type “python hello.py”.
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.
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.
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.