Introduction to Python

Python is a cross-platform computer programming language. It is an object-oriented dynamically typed language, originally designed for writing automation scripts (shells), with the continuous updating of versions and the addition of new features of the language, the more it is used for the development of independent, large-scale projects.


What is Python?

Python is a popular programming language. It was created in 1991 by Guido van Rossum.

It is used for:

  • Web Development (Server Side)
  • software development
  • math
  • system script

What can Python do?

  • Web applications can be created using Python on the server.
  • Python can be used with software to create workflows.
  • Python can connect to database systems. It can also read and modify files.
  • Python can be used to process big data and perform complex mathematical operations.
  • Python can be used for rapid prototyping or production-ready software development.

Why Python?

  • Python runs on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.).
  • Python has a simple syntax similar to English.
  • Python’s syntax allows developers to write fewer lines than some other programming languages.
  • Python runs on an interpreter system, which means that code can be executed as soon as it is written. This means prototyping can be fast.
  • Python can be approached in a procedural, object-oriented or functional manner.

Features of Python

  • Easy to learn – Python has few keywords, simple structure and well-defined syntax.
  • Ease of Maintenance – Python’s source code is very easy to maintain.
  • Extensive Standard Library – Most of Python’s libraries are highly portable and cross-platform compatible on UNIX, Windows, and Mac.
  • Interactive Mode – Python supports interactive mode which allows interactive testing and debugging of code snippets.
  • Portable – Python runs on a variety of hardware platforms and has the same interface on all platforms.
  • Extensible – you can add low-level modules to the Python interpreter. These modules enable programmers to add or customize their tools to increase efficiency.
  • Databases – Python provides interfaces to all major commercial databases.
  • GUI programming – Python supports GUI applications that can be created and ported to many system calls, libraries, and Windows systems such as Windows MFC, Macintosh, and Unix’s X Window System.

Python installation

Many PCs will already have python installed.

To check if you have python installed, open a terminal and enter:

python --version

If you find that python is not installed on your computer, you can download python for free from: https://www.python.org/


Python Quick Start

Python is an interpreted programming language, which means that as a developer, you need to write Python() files in a text editor, .py , and then put those files into a python interpreter to execute.

The way to run a python file on the command line is as follows:

 python helloworld.py

Python Command Line

To test a small amount of code in python, sometimes the quickest and easiest way is to not write the code to a file. This is possible because Python itself can be run as a command line. Enter python into your terminal:

python

From there you can write any python code:

Python 3.10.0 (tags/v3.10.0:b494f59, Oct  4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

It says “Hello, World!” on the command line:

Python 3.10.0 (tags/v3.10.0:b494f59, Oct  4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello, World!")
Hello, World!

Once you are done in the python command line, just type the following to exit the python command line interface:

exit()