Basics of Python for Data Science— Part One

Aditya Daria
3 min readApr 10, 2022

Hello and welcome to Python Basics. Hope the sessions help you understand why so many professional developers are inclined towards Python and how you can use it for your own projects.

These lessons are targeted at beginners who are either starting with no programming experience whatsoever or who know a little programming but not the Python language. I will try to keep this as simple as I can so anyone with no Computer Science degree can easily grasp.

This will be a six part series where I will try and cover python basics in detail. Later we will also cover Python Interview questions, Python for Data Science and ML in detail as well.

I am using Jupyter notebook which is an incredibly powerful tool for developing and presenting Data Science projects. The article here explains clearly on how to get started with Jupyter notebooks. Please do let me know if you want me do a separate article on Jupyter Notebooks.

Why python?

  • It was mainly developed for emphasis on code readability, and its powerful set of libraries and tools allows programmers to express concepts in fewer lines of code.

What does Python offer?

  • Python is an interpreted, high-level, general-purpose programming language.
  • Python is open source and has a strong community support.
  • Very readable and easy to learn.
  • Python is loved by everyone from beginner to experienced programmers for its simplicity and powerful set of libraries and tools which makes working with all sorts of data really trouble free.

1 : Variables

A name that is used to denote something or a value is called a variable. Variables can be declared and values can be assigned to it as follows :

We have assign values of 7 and 10 to variables x and y respectively.

Also we often judge simplicity of a language based on “Hello World” test. Lets try that using Python.

It’s that easy

You see how special Python language is? Now lets try to add the variables we created above

Adding two variables

We can also assign multiple variables with the same value

Variable assignment with same values

2: Arithmetic Operators

Below are some of the Arithmetic Operators and the tasks they perform. Lets try and put them to use:

Arithmetic Operators

Oh did I mention you can use # to comment on Jupyter Notebooks.

Using +, — , * and /

Below we have tried to use additional arithmetic operations :

Mod, Floor Division and Power

3 : Relational Operators

Now lets talk about relational operators. Below are some of them

Relational Operators

Below examples are self explanatory, but if you have any questions please comment!

I will continue with Bitwise Operators, Built in functions and print statement in my next article so please follow if you are not doing it already. :)

For any suggestions/feedback please comment. If you liked the article please consider following and subscribe using my link.

--

--