Python is a high-level, interpreted, general-purpose programming language.
Its design emphasises code readability through the use of significant indentation.
Python is dynamically typed and garbage-collected.
A high-level programming language is one that abstracts the details of the computer.
When writing a program using any programming language, all code written is converted into machine code, which is binary 0s and 1s.
However, for programmers, writing a program using machine code is extremely difficult since a computer's processor can only process machine code.
Programmers who used to code in machine code did not use 0s and 1s.
Instead, they wrote code in a more readable format, such as decimal, octal, or hexadecimal.
This code was then translated into an internal format by a program called a loader.
Back in the early days, programming a computer using machine code was quite difficult.
To reduce this difficulty, assembly language was introduced, which provided one abstraction level on top of machine code.
Unlike binary code, assembly code had some human-readable symbols, numerics, strings, etc.
In assembly code, we had to directly work with hardware features of the processor, i.e., its registers.
Writing code in assembly language was still difficult, so another layer of abstraction was added on top of it.
A more human-readable language, like the C programming language, was introduced to make coding easier.
A general-purpose programming language is a language that can be used to develop software for a wide range of application domains.
Python is a GPL that can be used to write desktop software, web applications, data science, ML, etc.
In contrast to general-purpose programming languages, we also have domain-specific programming languages, such as SQL.
DSLs are used within a specific area, such as SQL, which can only be used for querying relational databases and nothing else.
Code readability refers to how easy it is for a human to read and comprehend code.
Python is a programming language that places special importance on code readability and is one of the most readable programming languages.
Code readability is important because if code is readable, more people will be able to use it and it will be easier to maintain.
Another reason why code readability is important is that as a programmer, you will spend most of your time reading, understanding, reusing, and modifying existing source code.
Indentation refers to having space at the beginning of a line of code.
Indentation makes code more readable, but in programming languages like C, C++, and Java, indentation is only used for code readability and formatting.
In Python, indentation is part of the syntax and is used to indicate a block of code.
For example, in Java, we use curly braces to represent a block of code, whereas in Python, we use indentation, i.e., spaces to indicate a block of code.
In programming languages like C, when you declare a variable, you also set the type for that variable, and the type of that variable cannot be changed during execution.
In Python, you do not have to declare the type while creating a variable.
Due to dynamic typing, a variable can have a different type at different times during execution.
In dynamic typing, the type of variable is decided at runtime.
Garbage collection is a process of automatic memory management.
In Python, we do not have to worry about freeing up or reclaiming allocated and unused memory because it is garbage collected.
Garbage collection automatically reclaims memory that was allocated by the program but is no longer in use.
As programmers, we do not have to manually deallocate memory.