On this page
Python : Getting Started
Python : Getting Started
Play Video
Python is a popular programming language. It is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation. Its language constructs and object-oriented approach aim to help programmers write clear, logical code for small- and large-scale projects.
It is dynamically-typed and garbage-collected. It supports multiple programming paradigms, including structured (particularly procedural), object-oriented and functional programming. It is often described as a “batteries included” language due to its comprehensive standard library.
Gui-do van Ro-ssum began working on Python in the late 1980s as a successor to the ABC programming language and first released it in 1991 as Python 0.9.0. Python 2.0 was released in 2000 and introduced new features such as list comprehensions, cycle-detecting garbage collection, reference counting, and Unicode support. Python 3.0, released in 2008, was a major revision that is not completely backward-compatible with earlier versions. Python 2 was discontinued with version 2.7.18 in 2020.
On this page
Python can be used for:
- Web development (server-side),
- Software development,
- Mathematics,
- System scripting etc.
Key Points
Created by | Guido van Rossum |
---|---|
Released in | 1991 |
To check if you have python installed on a Windows PC, Linux or Mac, then open the command line and type:
python --version
If you find that you do not have Python installed on your computer, then you can download it for free from the following website: https://www.python.org/
Python is an interpreted programming language, this means that as a developer you write Python (.py) files in a text editor and then put those files into the python interpreter to be executed.
The way to run a python file is like this on the command line:
python helloworld.py
The Python Command Line
To test a short amount of code in python sometimes it is quickest and easiest not to write the code in a file. This is made possible because Python can be run as a command line itself. Type the following on the Windows, Mac or Linux command line:
python
Or, if the “python” command did not work, you can try “py”:
py
From there you can write any python code:
Example:
print("Hello, World!")
Whenever you are done in the python command line, you can simply type the following to quit the python command line interface:
exit()
Python Indentation:
Indentation refers to the spaces at the beginning of a code line. Where in other programming languages the indentation in code is for readability only, the indentation in Python is very important. Python uses indentation to indicate a block of code.
if 5>2: print("Hello. Welcome to Python programming language...")
Output:
Python will give you an error if you skip the indentation:
if 5>2: print("Hello. Welcome to Python programming language...")