Python is a high-level programming language. It is simple to read and understand, making it easy to develop applications rapidly. If you are new to programming, Python is a great language to start. Python's shallow learning curve enables many programmers new to Python to start new projects with the least amount of learning time.
Like SQL, Python code is similar to the English language. That makes it easy for us to understand, but not for our computer platforms. Therefore, the easy-to-read Python code we write should be translated into an intermediate language that machines can understand. That is called interpretation. We need a Python interpreter, commonly known as a compiler, to do that.
Python is cross-platform, which makes creating applications with Python much more productive. Python can be used to develop various applications, such as Web Applications, games, Machine Learning, Artificial Intelligence, Data Science, Desktop apps, and Web Scraping applications.
Python was created in the 1980s by Guido van Rossum. Python's design philosophy emphasizes code readability and simplicity. Python consists of best practices from several other languages, such as ABC, Modula-3, C, and C++.
Python is a platform-independent scripting language that is easy to read and understand. Its syntax is similar to English and has less syntax and complexity compared to other high-level languages.
Python is a good entry point for people who are new to programming.
Before we write our first line of Python code, we have to have the Python compiler installed on our working platform.
To install the compiler, visit https://www.python.org/downloads and download the recommended compiler version. See the header section of the page to download the recommended version.
Installation is straightforward, no different than any other app installation. Make sure to set the PATH variable during the installation process. Once the installation is complete, open the python shell.
In windows, type IDLE in the search text box and press enter. That will open your Python shell. You are ready to code in Python.
In macOS, follow the below steps.
This will open your Python shell. You are ready to code in Python.
Python shell behaves similarly to the windows command line. It interacts with the user by responding to each command input, meaning one command at a time. Below are some sample commands you can issue to shell to familiarize yourself with Python syntax.
>>> import sys
>>> sys.version
'3.10.7 (v3.10.7:6cc6b13308, Sep 5 2022, 14:02:52) [Clang 13.0.0 (clang-1300.0.29.30)]'
>>> sys.version_info
sys.version_info(major=3, minor=10, micro=7, releaselevel='final', serial=0)
>>> 5.0*2.0
10.0
>>> (4.0**0.5)**0.5
1.4142135623730951
>>> var1=24.5
>>> var2=17.5
>>> var1
24.5
>>> var2
17.5
>>> var1+var2
42.0
As you may have noticed, the Python shell helps test some commands. But it cannot offer anything useful for us to use in the real-world production environment. Once the Python shell window is closed, all the statements you issued are wiped out.
To develop a reusable application, we must save the Python code on a file and execute it as needed. We will use this approach as our code gets longer and more complex.
The next chapter will learn about How to start with python programming.