It is a simple Python tutorial for anyone who wants to learn Python.

Photo by Hitesh Choudhary on Unsplash

Earlier I took the Python lesson from Jose Marcial Portilla from Udemy and if you like you can check out his course here: Python Bootcamps: Learn Python Programming and Code Training | Udemy . Highly Recommended.

Let’s Get Started

I am assuming you have installed Python in your machine. If not, you can install Anaconda distribution (which includes everything) or manually install Python in your machine. Below links could help you out.

Anaconda | Individual Edition

Python 3 Installation & Setup Guide — Real Python

To run your first code, either you can use some IDES like Jupyter Notebook, VS Code or use your terminal and run the python file.

To print anything, we can use print function in Python.

print("Python is good")


In any programming language, variable is something like container or space to store something. Here in Python, it is a simple value. It could be string or some decimal or float number or some other data types. Let’s quickly store your name and print it.

myFirstName = "Soumyabrata"

To declare the variable name, you should use camelCasing (first letter in a word in capital) as I do it here for variable declaration or underscores to connect words my_first_name. but you can not use numbers or some special characters to declare the variables like $myFirstName or 12myFirst etc.

In Python, there are 6 data types. Some of them are Numbers, String, List etc. But all of them are dynamic. Like other low level language, you don’t have to mention them in the variable declaration.

Each data type is different, you could find the type of data you have. You can simply use, type(variable) function to find the data type. Suppose I would like to find the data type of myFirstName, I will write


By the way, to commented out something, you could use # in Python.


Like other programming language, Python has some build it operators. Like multiplication(*), summation (+), subtraction (-) etc. Here I have given some of the operation in the variable and it’s meanings commented here

variable = 2 + 3

String and f-strings

In Python, you can handle string in many ways. The most efficient way would be f-strings method. Through the below examples, you will understand it better. I will give the same example using the traditional approach (.format and others) and f-strings approach.

name = "Soumyabrata" 
age = 30
favorite_food = "Chow"

# traditional-l:
print("My name is", name, ", my age is", age, ", and my favorite food is", favorite_food)

What do you think, which one is the best? using f-string you can create the text very easily and see what is happening inside the code.

You can do the same using .format or other methods but as per my understanding, it is not very user friendly as the f-string. What do you think?

This is what I have learned as of now. I will share my new findings on Python next week. I hope you enjoyed Python so far.

Business Analyst/ Data Scientist at Genpact