Python Important Concepts

In the name of Allah, most gracious and most merciful,

1. Programming Paradigms

1.1 Procedural

  • Step by step sequence of instructions.
  • Programming Languages’ Examples: C, Pascal

1.2 Declarative

  • It describes the solution characteristics rather than precise steps on how to solve a problem.
  • Programming Languages’ Examples: SQL, Prolog

1.3 Functional

  • Solving problems through a chain of functions (actions) that are combined to transform input(s) to output(s).
  • Programming Languages’ Examples: Haskell, OCaml, ML

1.4 Object-Oriented

  • Seeing the world in terms of objects (nouns) that could interact together by actions (methods).
  • Programming Languages’ Examples: Java, Smalltalk Programming Languages

1.5 Multi-Paradigm

  • Any of the previous programming styles is applicable and could be mixed according to the specific needs of the problem at hand.
  • Programming Languages’ Examples: Python, C++, Scala

2. Important Terminologies

2.1 Graphical User Interface (GUI)

You interact with the computer using the mouse where you click on some user-friendly icons, buttons, etc. that appear on your screen so that the computer takes your mouse input as instructions to implement in the background.

2.2 Terminal (Technically called a “Terminal Emulator”) – Command Line Interface

An interface to write the commands using keyboard to interact with the computer instead of using GUIs and the mouse.

2.3 Shell

Is an example of a program that takes input commands from the terminal, executes some program or code, and then gives you the output that you see in the terminal. So at the end of the day, it is a program running in the background while you are giving written instructions through the terminal. Here you can use the “Python Interpreter” as the program to communicate with the terminal instead of the shell. But Python is better used to run code in files rather than interacting with the terminal since the shell is more efficient in doing that job.

There are even different shell programs from which you can choose: GNU Bash, TCSH, KSH, and Seashell.

2.4 Console

  • Is a special sort of terminal.
  • It sometimes means the keyboard and monitor physically attached to the computer.
  • It is sometimes used as a terminal synonym.

4. Python Code Execution

1. Running Python Locally

Python Package Managers

package manager or package management system is a collection of software tools that automates the process of installing, upgrading, configuring, and removing computer programs for a computer’s operating system in a consistent manner.

If you want to run Python locally on your computer you can packager managers like:

  • conda
  • apt
  • pyenv
  • choco
  • brew
Python Code Execution Example

Python could be run from the command line, or within the Python interactive interpreter.

# to get to the interactive interpreter from the command line type the following in your terminal
>> python3
# or type the following for entering another interpreter which has superset of the functionality of
# the normal Python interpreter
>> ipython3
# to quit type the following in your terminal or press (CTRL + D)
>> quit()
# if you want to run a file like '' which contians Python code then type in your terminal
>> python3
# to enter an interactive prompt after that to have access to top-level symbols for debugging use
# this -i flag like this
>> python3 -i

2. Running Python on the Cloud

Otherwise you can run Python using cloud services like Google Colab or Kaggle Kernel. Both have hardware accelerators like GPUs, and TPUs which are important for running machine learning problems that takes much time.

5. Python Philosophy

Python is a really special programming language whose philosophy has a very important idea that the Programmer is more important than the program.

# by typing the following in the Python interpreter you could see the Python high-level programming
# philosophy
import this
# some of the output is
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!


Thank you. I hope this post has been beneficial to you. I would appreciate any comments if anyone needed more clarifications or if anyone has seen something wrong in what I have written in order to modify it, and I would also appreciate any possible enhancements or suggestions. We are humans, and errors are expected from us, but we could also minimize those errors by learning from our mistakes and by seeking to improve what we do.

Allah bless our master Muhammad and his family.


Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x