How can I Learn the Basics of Python?

by | Nov 4, 2019 | Python Programming

15 Min Read. |

Python is a high-level, object-oriented programming language that has become quite popular among the developers. This is because of the flexibility that the language offers which gives it complete power for creating simple as well as large-scale, complex enterprise solutions.

The language was created by Guido VanHow Rossum in the late 1980s and was named after the hit 1970s BBC comedy show ‘Monty Python’s Flying Circus’. There are different domains in which the Python programming language can be used including web development, statistical data analysis, development of graphical applications like games, etc. The reason behind this popularity is the ease of learning the language.

Because of its popularity, you can find the application of Python everywhere, including some of the major websites like YouTube, Dropbox, Reddit, etc. Web frameworks powered by Python such as Django are used in Pinterest and Instagram.  Here are some of the properties of Python programming language that makes it so easy to learn:

It is a dynamically, implicitly typed language which means that there is no need of explicitly declaring the data type of the variable since the data type is enforced at runtime.

It is an object-oriented language.

The multiple libraries offered by the language make performing complex operations easily.

Python - A highly Popular Programming Language

Python – A highly Popular Programming Language Source – Hackernoon

How to Learn Python?

To begin learning Python, you need to first install it on your system. Yes, that’s simple.

Python is open-source software that is compatible with 21 platforms like Mac, Windows, Linux, etc. Since it is preinstalled of most Linux distributions and Mac, you might have to download the language’s latest version. For this, you need to first check the version installed on your system.

Run the following command in the terminal to do so:

Python – V

Now, for selecting the latest version of Python, you might get confused deciding whether to get Python 2 or 3. However, it is important to know that there are only a few differences between the two. The 3.5x version is still in developing new functionality and features. 2.7x and 3.2x to 3.4x version of Python are actively maintained.

Deciding which version is best for you completely depends on your needs. Also, once have mastered one version, it won’t be hard to master another. If you are a beginner in Python and not sure which version suits your needs, go with the version 3.4x which has added features, refinements, and fixed bugs.

However, if you are planning on using libraries, you should go with 2.7x version that has added support from libraries because not all libraries have been ported to the 3.4x version.

You have to download the Python according to your operating system and the processor from the official website of Python Software Foundation (PSF). There are a few instructions that you need to follow for downloading Python depending on the operating system that you are using:

  1. Mac – Use Homebrew for installing and managing different versions of Python. 
  2. Linux – Use the package manager for updating the Python to the latest version.
  3. Windows – Use the official website of PSF to download Python. Make sure that during the installation process, you add Python to the system. For this, you need to select the option for installing Python on a local hard drive from the drop-down menu.

The next step is to confirm if Python was installed correctly on the system or not. For this, you need to fire up the Python interactive shell. Here are the steps you need to take depending on your operating system:

  1. Mac – Open the terminal and type: Python or Python3, depending on the version you installed.
  2. Linux – Fire up the terminal and type: Python.
  3. Windows – If you have just one Python’s version installed, type Python. If you have 2.7, as well as 3, installed, use Python for 2.7 and py -3 for 3. But you need to have administrative privileges.

Now that you have successfully installed Python on your system, you can start learning the basics of Python. You might be wondering about the best way to learn Python.

Download Detailed Curriculum and Get Complimentary access to Orientation Session

Date: 13th Feb, 2021 (Saturday)
Time: 10:30 AM - 11:30 AM (IST/GMT +5:30)
  • This field is for validation purposes and should be left unchanged.

Learning how to learn is the first step to learn anything. It is the most important skill that you can have. Why? Because languages evolve every day as libraries and tools are created and upgraded. To keep up with these changes and become a successful Python programmer, you need to know the processes and strategies involved in learning Python.

Here are a few tips that will help you better grasp the concepts of Python programming language:


The most important step is to remain consistent while learning the language. Make a commitment to practice coding every day. Start with just 30 minutes a day and then gradually increase the coding time. It will surely be difficult at first but once you make the commitment and follow-through it, you will be developing your muscle memory that will help you retain concepts better. You can try working on some easy exercises that you can easily find online.

As you go through the concepts of Python, make sure that you take notes. It is a very important step in the learning journey of a beginner programmer. Studies have shown that the best method to learn something is to take notes. If you are planning to become a full-time Python developer, your notes will also help you with interviews.

Practice Coding Everyday

Practice Coding Everyday | Source – Make Use

When you have started developing programs and working on projects, you should write the code by hand. This will help in planning the code before you move on to the system. If you decide beforehand the classes and functions that you will be using as well as their interaction in your code, it will help save you a lot of time.

Go interactive

Python interactive shell is the best learning tool to learn the basic data structures of Python like lists, strings, dictionaries, etc. or debug the application. For using the interactive Python shell, also known as Python REPL, the first step is confirming the installation of Python on the system. Just type Python on the terminal and start coding.

Once you get to complex programs, getting stuck on a bug is inevitable. The more complicated a program is the more bugs you will face. At times it will get a lot of frustrating to deal with. You need to have a strategy and a methodological approach to help find a solution when things are getting out of your hands.

For this, you need to go through your code from the start and make sure every part works to find out where the problem is. Type import pdb; pdb.set_trace() into the script. It is the Python debugger and it will open up the interactive mode. To run it from the command line, type Python –m pdb <>.

The best way to learn to code is by practising. And what better way to practice than building something?

If you are an absolute beginner at coding, you can try some small exercises that will help you learn how to implement the concepts of Python programming language. Once you have a good grasp over concepts like classes, data structures and object-oriented programming, you can start creating your very own projects.

All the python courses you take and the articles you read on Python will only help you reach so far. Implementation is the key to becoming a successful Python developer. The more problems you solve, the better developer you will become. Here are a few examples of Python projects for beginners that you can try:

  • Dice roll simulator
  • Simple calculator
  • Bitcoin price notification
  • Number guessing game

Taking a step back

It is always good to take a step back every once in a while. You should learn how to step away. This will help in absorbing the concepts. There is a popular technique named as the Pomodoro Technique in which you study for 25 minutes and then take a break.

This is an effective study technique as the breaks help you take in all the information. Breaks are also very important when you are stuck with a bug. If you can’t figure out a method to debug, get up from your computer, take a walk and talk with someone else.

When you are coding, following the rules and logic of the language is extremely important. A simple quotation mark can cause a lot of issues. New eyes can help make a difference.

Collaborating with others

Coding is a solitary activity. However, if you want to learn better, you need to surround yourself with fellow Python developers. Communicating with other beginner programmers will help you learn to code. You can also share tricks and tips that you learn along the way with other Python developers.

If you don’t know anyone, you can try one of the meetups to collaborate with fellow developers. You can find groups and events at to become a part of the Python community.

Pair programming is a coding technique where two coders work at a problem on a single workstation. There are two roles, the driver and the navigator. Both the developers switch the roles. The driver is tasked with writing the code. The navigator is responsible for guiding the problem-solving approach and reviewing the code.

To get the most out of this method, the switch is made frequently. With this approach, not only will you have a chance of getting your code reviewed by someone, but you will also be able to get a different perspective of the problem. The more ideas and thinking approach you have, the better chance you will have of solving the problem.

Become a Good Python Developer

Become a Good Python Developer

You can also try contributing to the Python community. Python is based on an open-source model, meaning that the source code is publicly available and any Python developer can contribute towards it. Apart from this, there are also several libraries of Python that are open-source and take contributions.

There are also several companies known for publishing open-source projects. This means that you are allowed to work with the code that is written by engineers employed in the company. If you contribute to an open-source Python project, it will help create a valuable learning experience for you.

If you sent a request for bug fix, you will have to submit a pull request so that your fix can be patched to the code. After your work has been reviewed and commented on by the project managers, he/she will give you some suggestions to improve your fix. This will not only help in learning the best practices used in Python programming but also how to communicate with other professional developers.

Download Detailed Curriculum and Get Complimentary access to Orientation Session

Date: 13th Feb, 2021 (Saturday)
Time: 10:30 AM - 11:30 AM (IST/GMT +5:30)
  • This field is for validation purposes and should be left unchanged.


Teaching can be considered as one of the best methods for learning. The same goes when you are trying to learn the Python programming language. There are several ways to achieve this. You can try blogging about concepts of Python, whiteboard with fellow Python developers, record a video explaining the newly learned concepts or just talk to yourself.

All these methods will help in solidifying your foundational knowledge and also help in exposing any gaps that might be present in your understanding.

Asking questions

When it comes to programming, there are no bad questions. However, there are some questions that are just asked badly. When you are seeking help from someone who has no context of the problem that you are working on, you need to follow the GOOD acronym:

  • G: Giving the context of the problem and the approach you are taking.
  • O: Outlining all the things that you have tried to fix the issue.
  • O: Offering the best guess on what the issue might be. This will give the person an idea of what you are thinking, what to consider, what to eliminate, etc.
  • D: Demonstrating the issue. Get the code or the error message that you are facing. Explain all the steps that you took that resulted in the issue. This helps save the time required for recreating the issue.

This method can help save a lot of time. If you skip any of the above-mentioned steps, at some point, you will have to converse back and forth regarding the issue that can result in conflict. If you are a beginner at coding, you need to learn communication of thought process so that the people who are trying to help you do not get frustrated and continue to help you.

Here are a few resources that can help you learn the basics of Python:

  1. 1. The official documentation available on Python – Python 2.7 or Python 3
  2. 2. For simple and easy examples on Python, visit Tutorials Point.
  3. 3. Website of Jeff Knupp, who is the author of tutorials and books of Idiomatic Python series.
  4. 4. For advanced topics and frameworks like Flask and Django, try the Real Python Tutorials section.
  5. 5. For getting answers to all your questions, you need to visit Stack Overflow.
  6. 6. The Python Course by Digital Vidya provides full coverage of the language.

Download Detailed Curriculum and Get Complimentary access to Orientation Session

Date: 13th Feb, 2021 (Saturday)
Time: 10:30 AM - 11:30 AM (IST/GMT +5:30)
  • This field is for validation purposes and should be left unchanged.

Now that you know the study approach that you will be using to learn Python, it is time to take a deep dive into the language. You need to build a strong foundation to become a good Python developer. Here are a few concepts that you must learn by heart to be able to code effectively and efficiently:

The primitives

Here, we are going to take a look at the coding primitives of Python:


You can consider variable as data containers. The syntax for declaring a variable in Python is:

variable_name = variable_value

You can give any name to a variable except for reserved keywords. However, giving an intuitive name to the variable providing indication to its assigned value will help keep track of them. Many beginners use x and y as variable names. This is not a good habit as it will only create confusion. 

Data types

There are a number of data types built-in Python such as strings, numbers, tuples, lists, and dictionaries. To manipulate these, you need functions, operators, and data-type methods. Let’s take a look at each data type:


There are three major types of numbers used in Python:

  • Integers – 1, 2, 11, 123, -123
  • Floats – 1.0, 2.12, 11.23,  -11.23
  • Booleans – True or False (1 or 0)

The operators used for manipulating numbers include simple arithmetic operators like addition (+), subtraction (-), etc. Take a look at this example:


>>> 2 + 3   # Addition


>>> num1 = 10

>>> num2 = 9.99

>>> num3 = num1 + num2

>>> num3


>>> 8 5   # Subtraction


>>> 2 * 6   # Multiplication


>>> 2 < 5


>>> 4 > 10


>>> 7 % 3   # Modulus (returns the remainder from division)


>>> 3 ** 2  # Raise to the power


There are also a number of functions built-in Python for manipulating numbers. For example, the function float() that returns the float value of an integer. Int() returns the integer value of a float.

Also, there are some data type methods like float.is_integer() that is used for testing whether the float is finite or not.

Download Detailed Curriculum and Get Complimentary access to Orientation Session

Date: 13th Feb, 2021 (Saturday)
Time: 10:30 AM - 11:30 AM (IST/GMT +5:30)
  • This field is for validation purposes and should be left unchanged.

  • Strings

These are the line of text declared using single or double-quotes. When it comes to their manipulation, string concatenation can be used. Here is an example:


>>> “happy” + ” “ + “birthday”

‘happy birthday’

>>> “my name is “ + “john”

‘my name is john’

There are also a number of functions used for manipulating string like len() which returns the length of the string, slice() that is used for accessing a set of characters from a string, etc.

The data types used for string include string.capitalize() for capitalizing the first letter, string.format() for formatting values into strings, string.strip() for removing the whitespace from front and back of the string, etc.


These are used for grouping different types of data together. It may contain any data type, a list or nothing at all. You can access a specific part of the list using indexes. Take a look at this example:


>>> create_a_list = []

>>> create_a_list


>>> numbers_list = [1, 2, 3, 200]

>>> numbers_list

[1, 2, 3, 200]

>>> strings_list = [“batman”, “superman”, “iron man”]

>>> strings_list

[‘batman’, ‘superman’, ‘iron man’]

>>> mixed_list = [“Hello World”, [4, 5, 6], False]

>>> mixed_list

[‘Hello World’, [4, 5, 6], False]

Just like strings, lists can be concatenated too. Also, all the functions used for strings can be used for lists as well. The data type methods used for lists are a bit different. For example, list.append() is used for adding an item to the list, list.sort() is used for sorting the list, list.pop() removes an item from the list. 

  • Tuples

These are similar to lists. The only difference is that once you create them, they cannot be modified. Here is an example:


>>> my_tuple = (“Michael”, “Herman”, 31, “Software Developer”)

>>> my_tuple[1]


When it comes to manipulating tuples, you have the option to add them. Here is how you can do it:


>>> first_tuple = (1, 2)

>>> second_tuple = (3, 4)

>>> third_tuple = first_tuple + second_tuple

>>> third_tuple

(1, 2, 3, 4)

Since tuples are immutable, there are not a lot of functions and data type methods that can be used on them. You can convert it to a list using list().

  • Dictionaries

These are unordered, an associative array that is implemented through hash tables. 

my_dict = {“Key 1”: “Value 1”, “name”: “michael herman”, “pi”: 3.14}

  • Comments

These can be considered as notes written by developers for describing the code so that other developers can understand what the code is about.

Download Detailed Curriculum and Get Complimentary access to Orientation Session

Date: 13th Feb, 2021 (Saturday)
Time: 10:30 AM - 11:30 AM (IST/GMT +5:30)
  • This field is for validation purposes and should be left unchanged.


When it comes to coding in Python, there are three approaches:


This is used for mainly one-line simple statements for getting feedback on your code. This is because once you exit the interactive shell; all your code will be gone. 


This is similar to Python shell in terms of its interactivity. However, in this, you can save your code which you can reuse later. 

Code Editor

This is the best and most powerful method used for running Python program. Also known as IDE, you will be able to learn operation easily.

Selecting a Code Editor

Although you can write Python scripts in a text editor as simple as Notepad, using a code editor will help you create programs easily. A good code editor customizes the program according to your style and needs. Here are a few characteristics of a good code editor:

  • Easy to use
  • Highlighted syntax
  • Automatic indentation
  • Line numbering
  • Tabbed views
  • Add-ons availability
  • Option for customizing the editor

Some popular text editors are Sublime Text 3, gedit, Notepad++, Vim, etc.

Here are a few tips that will help you whenever you are stuck on a problem:

  1. 1. Take a break from coding.
  2. 2. Map out a possible solution to the problem on a paper using a flow chart.
  3. 3. Use exception handling – try/except.
  4. 4. If you are getting an unexpected output, you can try adding a print statement after you have assigned the variable and then again right before the output.
  5. 5. You can try using a tool named Python Visualizer that allows stepping through the code as it is executed.
  6. 6. If you are getting too annoyed, go for a run. This will help you clear your mind and look for mistakes in the code.

Now that you have a basic understanding of the Python and have the right editor, you can start coding.

Moreover, knowing all the potential python interview questions and answers can be of added advantage to you and will help you in easily cracking the interview.

Final Thoughts

With a Python Programming course, you can become a Python coding language master and a very qualified Python programmer. After the course, any aspiring programmer can learn from Python’s basics and continue to master Python.

Register for FREE Digital Marketing Orientation Class
Date: 27th Jan, 2021 (Wed)
Time: 3:00 PM to 4:30 PM (IST/GMT +5:30)
  • This field is for validation purposes and should be left unchanged.
We are good people. We don't spam.

You May Also Like…


Submit a Comment

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