Python Exercise Lists

Programming Languages Introduction

Python is an open and free scripting programming language. It is easy to use but also powerful. The Python programming language is like a english paragraph, thus non-professionals can also use Python. This chapter introduces the basics related to Python programming and also involves data science related packages.

Program is a series of instructions/steps that tell computer what to do because computer cannot understand human languages. Computer scientists have designed some symbols named as programming languages to communicate effectively with computer. The examples of high level programming languages such as Python, C, C ++, Java, Ruby, etc.

Programming languages has two levels, high level and low level. High level languages are imperative languages, functional languages, declarative languages, and object-oriented languages. While as, low level languages constituent machine language and assembly language. Usually, high level language will similar as english language. The high level programming languages are designed for programmers to understand and use easily.

In fact, computer hardware can only understand very low-level programming language named as machine language. Machine languages are binary language in form of 0 and 1. The performance of low level language better than high level language, but it is extremely difficult to write low level language.

The high level language needs to have both compiler and interpreter for converting purpose. They are languages which computer cannot understand hence the compiler shall be used to convert into binary form. As highlighted in the previous paragraph, the low level languages are in binary form thus no compiler is required for conversion purpose therefore only interpreter are required by low level languages. Let's further find out the different between computer and high-level programming languages to perform a sum operation between two numbers.

Example 1: Computer to perform a sum operation between two numbers

  1. First number located in the memory space at 001 being loaded into the CPU.
  2. Next, second number located in the memory space at 002 being loaded into the CPU.
  3. Perform a sum operation on these two numbers in the CPU.
  4. Lastly, store the result of summation at location 003.

The example 1 just a general description and in fact it is more complicated in actual situation.

Example 1: High-level programming languages such as Python to perform a sum operation between two numbers

  1. Summation of two numbers can be expressed as z = x + y.
  2. Next, using either compiler or interpreter to convert High-level Programming Language (Python) into Machine Language

A high-level language that uses a compiler to translate itself into machine language is called compiled language. Whileas, a high-level language that uses an interpreter to convert itself into machine language is called an interpreted language.

The difference between compiled and interpreted languages

Items Compiled Langauge Interpreted Language
Explanations Programming languages require all source code be converted into binary instruction, which is executed by a specific platform (Windows, Linux, etc.) at one time in advance. Programming languages can be converted while executing.
Programming languages C, C++, Golang, Pascal, assembly, etc. Python, Javascript, PHP, Shell, MATLAB, etc.
Advantages After compiling once, it can run without the compiler, and it runs efficiently. It is better performance in cross-platform. The same source code able to be interpreted through different interpreters into machine code on different platforms (Windows, Linux, etc.)
Disadvantages It is not flexible. It is inefficient due to conversion while executing.

Execution Flow of Compiled and Interpreted Languages

What is Program Steps and Program Flow?

The program steps is like a recipe or instruction, where a program is a sequence of steps to be done in order. Usually, they are two types of steps which under conditional flow:

  • Skipped: Sometimes one or some program steps may be skipped if under certain condition
  • Repeated: Sometimes the program steps can be stored and to be used repeated if under certain condition
                                      


More Tutorials:

Python Installation - Linux (Ubuntu)
Python Installation - Mac OS
Integrated Development Environment - IDE
Python - Basic Variables
Python - Sequence Introduction
Python - Output Formatting
Python - Escape Character
Python - Type Conversion
Python - Numbers
Python – Arithmetic Operators
Python – Assignment Operators
Python – Comparison Operators
Python – Logical Operators
Python – Precedence and Associativity Operators
Python – Bytes Type and Usage
Python – Long & Raw Strings
Python – Concatenate Function
Python – Slice Function
Python – Length and Split Function
Python – Join and Count Function
Python – Find Function
Python – Index Function
Python – Alignment Function
Python – Startswith and Endswith Function
Python – String Case Conversion
Python – Remove Specified Character
Python – Encode and Decode Function
Python – dir and help Function
Python – Input Output Introduction
Python – Basic Operation
Python – Open Function
Python – Read Function
Python – Readline Function
Python – Write Function
Python – Close Function
Python – Seek and Tell Function
Python – Pickle Module
Python - File Input Module and Linecache Module
Python - Pathlib Module
Python - Pathlib Module
Python - os.path Module
Python - fnmatch Module
Python - Tuple Introduction
Python - List Introduction
Python - List Add Element
Python - List Delete Element
Python - List Modification Element
Python - List Find Element
Python - Dictionary Introduction
Python - Dictionary Basic Operation
Python - Dictionary Method Guide
Python - Set Collection
Python - Set Basic Operation
Python - Set Basic Method
Python - Frozenset Method
Python - If Condition I
Python - If Condition II
Python - While loop
Python - For loop
Python - Pass Statement
Python - Break Statement
Python - Zip Reverse Function
Python - Function Introduction
Python - Positional Parameters
Python - Key Arguments
Python - None and Return
Python - Variable Scope
Python - Local Function
Python - Closure Method
Python - Lamdba Expression


More Python Exercises:

Python String Exercises
Python List Exercises
Python Library Exercises
Python Sets Exercises
Python Array Exercises
Python Condition Statement Exercises