This is a text field

Ultimate new guide for python beginners in 2021

Ultimate guide for python beginners

Python is high level interpreted and general purpose language. Hence, Python is great for beginners.

You’re going to see the ultimate guide for python beginners in 2021.

Before starting this you’ll see what’s the python? And why it made such an impact in the programming world?

That Dropbox created server from it and Microsoft creating CPython which is the implementation of the Python using C.

So, let’s start with python. And go deeper in it.

Introduction to python language

First, python is a general-purpose high level and interpreted language. Yet, it’s compiled and interpreted in both form.

Likewise, python is used in webserver and desktop applications.

It’s an object-oriented programming language. Hence, it deals with functions and classes easily.

If you’re a game developer then python is for you.

The reason behind this is that it interprets top to bottom. That means errors coming fast and solvable.

In C and C++ it takes time to come error and solve it.

So, you can see the benefits of the OOP in python.

Epic history of python in programming world

Here’s the curiousity, what’s the history of the python?

How did python started? And why python started?

In the 1990s, the Dutch programmer Guido van Rossum working in ABC Programming language.

In ABC, he was frustrated with the Graphical user interface of ABC.

Hence, he decides to create a programming language. That is simple and GUI efficient.

As today’s python is dissatisfaction of Guido toward ABC.

In 2020, he has announced to work with Microsoft to implement CPython.

To know more about this announcement check out here.

What you’ll get?

Why you’re reading this blog?

You’re reading this blog to know and implement python.

Python that is as simple as English.

So, you don’t need to focus on its syntax or rule. Focus on what’s important.

Hence, you can comment and free to ask.

Let’s start the python journey

So, let’s start with the python journey.

In the python journey, you’ll see different topics related to python.

When you go deeply into this blog post. You’ll get free access to all these topics.

I’ve created subheading for each topic.

I receommend you to code it. Only reading wouldn’t help.

Yet, to get an overview. You can read this ultimate guide.

Before, starting python you need to download python from

But if you want to use another ide’s or compiler. I’ve created a blog on the 5 Best python compiler in 2021 here.

I’m going to use thonny to write the program.

Syntax of python for beginners

Above all, a programming language is created on values. Values are rules that are the syntax of programming languages.

Likewise, Python has its own syntax to program.

Syntax of python is print(“hello”). It’s a simple as a English.

so, see it in thonny ide.

Syntax of python

In the above example, you can see the hello is displayed in the shell.

With the help of the print() statement, you can print any value in python.

We’ll go deeper in this blog with variables.

Variables in python

Variables are containers in python that store your value.

For an analogy, you can say that glass is holding water.

Here, glass is your variable and water is value to that water.

Likewise, python has variables and values associate with it.

As a result, you don’t have to declare variables.

Hence, it’s great for python beginners.

Variable in python for beginners

In the above example, you can see that “Welcome to heypython community!” is stored in variable a.

Here, you’ll observe the value has double-quotes. The double quotes represent the string data type.

You’ll know in a further blog.

But why do we need variables?

You can say that value is directly displayed through the print() method.

Yes, you’re right. But, to perform the mathematical operations and large statements, you need variables.

To know what we’re doing with variables you can use comments.


Comments in python showing what you’re doing in the program.

In a small program, you can avoid the comments. but in large programmes you need comments.

Comments are statements that doesn’t execute by the python interpreter.

Also, you can use comments to write your program the next day. That means next time you can see what you’ve done previously.

It represents by # and “””. Single line comment executes by # and multiple line comment execute by “””.

See it below.

Comments in python

In the above example, you can see that message info. declared in # symbol.

Comments are also useful in data types. Hence, we can find what we’ve done in data types.

Statements in python for beginners

The statement is a display function that simply displays the statement.

For example, print() statement display example, output of the program.

Likewise, if-else statement checks the conditions of the program.

Also, In loop for, while are statements.

for example,

print("hello, world")

>>> hello, world

Here, you can see that the print statement displayed the output.

You can use statements with expression.

Expression in python for beginners

Expression is a method that performs an operation on statements.

These operations are mathematical and symbolic.

For example,

expression in python

Here, you can see that +sign expression, combined the two values. it’s the expression that combined a and b.

Also, here is an integer data type. so, the expression gives an integer value.

if values are string then the output will be a string.

You’ll know more about data types in the next section.

Data types for beginners in python

Data types in python show the type of value. That means the value is number, words or characters.

For that, we use different data types.

Hence, you can use integer and float for numbers, string and character for words and boolean for true and false, set and so on.

But most basic data types are string, integer and float.

Data types in python

Here, you can see that we’ve displayed string, integer and float data types.

But if you don’t know which variable has which data type you can use the type() statement.

The type() statement shows the variable has which type.

For example,

type() in python

Here, in the above example, you can see that the data type of variables a,b and c have come.

Likewise, you can perform different operations on variables a,b and c using operators.

Operators in python

Operators in python perform different operations.

Such as adding, comparing, identifying and boolean operations.

Hence not the confusion for python beginners. Python community has divided operators into 7 categories for python beginners

Following are 7 categories:

  • Arithematic operator: In this you can perform operators such as +,-,//,%,*(multiply).
  • Assignment operator: Likewise, you can perform operators such as =,+=,-=,/=,%= and *=.
  • Comparison operator: To use operators such as ==,!=,>, <, <=,>= you can perform operations.

So, let’s execute these 3 categories operators.


Assignment, comparison and arithmetic operators

Likewise, you can use another 2 categories of operators.

The 2 other categories are

  • Logical operators: Such as and, or,not to combine multiple variables.
  • Identity operators: is and is not opearator to find one variables element in another element.

Logical and identity operators

In the above example, you can see the logical and identity operators.

Also, you can use the remaining 2 categories of operators.

  • Membership operator: It use to find the particular element in sequence. Use in and not in operator.
  • Bitwise operator: It use to compare the (binary) numbers. In th &,~,^,|,<<,>>.

For example,

Membership and bitwise operator

Here, I’ve shown you the Membership and bitwise operator.

Operators are very important for large programs.

Reserved Keywords for python beginners

Reserved keywords in python are system-defined words. such as if-else, in.

Hence, you can’t define these words.

So, you can’t use these words in creating variables, functions, classes and methods.

Till now there are 35 keywords.

This keyword have been used in creating the python. Such as loop, functions, class and methods.

Here, the example

Using reserved words in python

In the above example, you can see that I’ve used def as a variable name and got a syntax error.

I’ve created a post on all reserved words in python here.

List for different values

The list is an ordered, changeable and mixed data type of values.

As a result, you can store different data types of values.

That means you can store the int and string at one variable.

But why do you need a list?

You need a list to store values.

Such as names of students in the database.

Likewise, you can change the name. so that’s why you need a list.

The syntax of list is variable = [collection of values].

For example,

list in python

In the above example, you can see that student_list created.

Also, you can store different collection types. such as student_name and roll_no.

For example,

mixed type of list

Here, you can see that names and numbers are stored in a list.

Hence, if you’re python beginner then store multiple data items in a list.

But suppose you want a student name from the list.

How will you do it?

You can do it with indexing.


In indexing, you providing the position of element inside [].

Remember, the first element is in 0th position. such as variable[0] give you the first element in list

Likewise, the second element in the list extract by variable[1].

Lets’s see it by example,

Indexing in student_list

In the above example, I’ve indexed the student_list.

I’ve left the indexing of 3rd element in the list. It’s for your practice.

Write the syntax for getting the name “Pradeep” in the list.

You can also use negative indexing.

Negative indexing is useful when the list is large. And you want to find the last elements such as second last and third last.

For example,

negative indexing for python beginners

In the above example, I’ve indexed the second last element.

Hence for large elements, you can use negative indexing.

You can perform different operations on the python list.

To know more about the python list check out the python list here.

Python lists are different from tuples.

tuples are unordered collections of the data items.

Python Tuples

It’s an ordered, unchangeable and allow duplicate items.

Here, unchangeable means you can’t remove or update elements in a tuple.

It’s indicated by ().

Inside ()(round brackets) you can store multiple items in a single variable.

So, why do we need a tuple if you can use a list?

So, I’ve told you the list can changeable. That means anyone can change the list you’ve created.

But you’ve to share collection of data items to students,

Also, you need that anyone doesn’t change data directly.

So, you can store your data in tuples and share the data.

First of all, see how can you represent tuples.

For example,

tuples in python


It’s a ordered. hence, you can use indexing to extract the specific elements.

For example,

Indexing in tuple


Also, I’ve told tuple is changeable.

Let’s do it in code.

Unchangeable tuple

From the above example, you can verify that the tuple is unchangeable in python.

But that’s not the case in the list.

For example,

Changeable list

Dictionary in python for beginners

Dictionary is a data type that is separate from list and tuple.

Hence, it’s unordered, changeable and doesn’t allow duplicate items.

So, why are we using python dictionary?

You can use python dictionary to store data in the form of the key and the value.

Here, the key is a variable that associate value to it.

It’s represent by curly braces({}). Inside {} key and value present.

Syntax is : variable = {key : value}.

Dictionary is useful when you want to store data related to the particular entity.

Such as, to store information about a particular student.

For example,

dictionary in python

Here, you can see that you can store the dictionary with detailed information.

Hence, you can find what type of value. That means its name, age or std of the student.

This isn’t the case in the tuple and list.

Modify the values

Next, I’m going to show you how can you modify the value.

That means you have to change the age of the student.

You can do this by giving new value

for example,

Change the age of the student

Here, you can see that I’ve reassigned the value to key using student_info[“age”] = 20

Likewise, you can change the student name using student_info[“name”] = “john”

so, the syntax of reassignment is variable[key] = new_value.

Also, see that the dictionary is unordered using indexing.

When you try this, you’ll get key error.

For example,

Key-error in python

Here, you can see that when I tried to use indexing it has given key error.

Hence, you can see that the dictionary is an unordered proof.

Also, It doesn’t show duplicate items in the dictionary.

For example,

Duplicate items in the dictionary

Here, you can see that I’ve positioned the duplicate std key. Yet, only it shows one time in output.

So, the dictionary doesn’t allow duplicate items.

Note, you can store same values in different keys.

For example,

display same value

In the above example, you can see that ‘SYCS’ has been displayed multiple times because of different values.

But vice-versa isn’t true.

That means a similar key with different values only show one key.

That means in the dictionary duplicate keys are not allowed whereas duplicate values are allowed.

For example,

Duplicate key in the dictionary

In the above example, you can see that duplicate keys are not allowed.

At last, I’ve shown you the basics of the dictionary.

To know more about dictionaries check out this blog post here.

Function for large tasks

The function is a method where you can repeat the task by calling it.

The benefit of function is that you can display similar statements easily.

Suppose, you’ve to display the “My name names” for each person.

So, you’ll do it with a print statement.

For example,

display statements

In the above example, you can see that it’ll take a lot of time to write code.

Instead, you can use python-function to repeat this.

For example,


From the above example, you can see that how easily you can display similar statements.

First, you can represent a function with the def keyword.

The syntax is: def function_name(arguments).

Second, there is a whitespace inside the function block that represent the same block of code.

The structure of function is:

def function_name(argument):

function_name(value of argument)

Multiple arguments

You can also pass multiple arguments.

For example,

Multiple arguments

In the above example, you can see that I’ve passed multiple arguments.

so, in your program, you can pass and display multiple items.

Go to the first example, where I’ve displayed the statement of different names.

Here’s the trick, you can do it with positional arguments.

For example,

positional arguments

In the above example, you can see that you can pass multiple same types of arguments with asterisk sign.

Also, you can access these arguments with indexing.

Likewise, you can use keyword arguments.

With help of it, you can access arguments with keys and values.

Hence you don’t need to care about the position of arguments.

For example,

Keyword arguments in python

In the above example, you can see that you don’t need an order.

You can access the value using keywords.

The keyword argument use the **(double asterisk) sign.

Likewise, you can use default arguments. That means you want to fix the value of it.

You can do it with def function_name(variable = value,argument).

For example,

Default arguments

From the above example, you can see that I’ve set the default age and changed it.

Likewise, you can do it.

Function use many statements.

To know about different elements in python. Check out here.

The function is an important concept in python. so, you should care about it.

Classes- Blueprint of function

Classes are blueprints of creating objects.

That means it’s an object constructor in python.

For example, an Animal is a class and a lion is an object created from it.

You can represent a class with class class_name:

For example,

class Animal

Here, I’ve created the class and object.

Next, I’m going to access the attribute of the class using the (.) operator.

For example,

From here, you can see that using the dot(.) operator I’ve displayed the value lion.

It’s a simple class.

But most important class attribute has __init__ method.

__init__ Method

The __init__ method come up with the class.

Hence, it initialize the class.

For example,

Initialize the class

With help of the initialize method, you can pass different values to it.

Here, the self attribute initialize the current variable of the class.

This is the basics of the class.

To know more about classes check out here.


Finally, you’ve come to a point where I’ve covered the basics the basics of python.

Python is general purpose and high-level language.

Also, python is interpreted line by line.

Hence, it approaches the program top to bottom.

Likewise, it has data types. where you can represent with different data type.

Data types such as string, integer and boolean.

Also, you can use python function to repeat the task.

To bundle the functionality and data you can use classes.

So, what do you think about the ultimate guide? Is there anything you want to cover comment on it!

People also reading

Section of HOW TO?

My Skill
I've completed 50%
Avatar for Vipul kunwar
Follow me

    Leave a Reply

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

    Back to top