Introduction to Programming with Python

WHAT | HOW | WHY

Introduction to Programming with Python

This article will cover the following three points.

  1. What is programming languages?
  2. How does computer programming work?
  3. Introduction to Python?

basic_intro.png

Can computer talk like a human?

computer_think_like_human.png

No, Computers can not understand the language that we human understand. So, we need a language which computer can understand i.e. Programming Language.

Why Programming language?

  • A computer cannot perform any task on its own.

  • To talk in the same language that the computer can understand

  • To communicate with the computer

  • To give a proper set of instructions

What is programming program?

A computer program is a set of instructions that we provide to a computer in order to get a task done.

How programming languages work?

A computer works by training input, processing it(during which it gets access to memory storage) and then producing an output based on the process it went through.

programming_process.png

work-flow.png

Types of languages

Procedural

  • Specifies a series of well structured steps and procedures to compose a program.
  • Contains a systematic order of statements, functions and commands to complete a task.
  • E.g. BASIC, C, FORTRAN, Java, and Pascal, etc.

Functional

  • writing a program only in pure function i.e. never modify variables but only create new ones as an output.
  • used in situations where we have to perform lots of different operations on the same set of data, like ML
  • first class functions
  • E.g. Javascript, R, SQL, Kotlin, Python, Go, Rust, etc.

Object Oriented

  • revolves around object
  • code+data=object
  • developed to make it easier, debug, reuse and maintain software.
  • E.g. Java, C++, C, Python, Ruby, Perl, etc.

Static vs Dynamic Languages

Static

  • Perform type checking at compile time
  • Errors will show at compile time
  • Declare datatype before you use it
  • More control

Dynamic

  • Perform type checking at runtime
  • Error might not show till program is run
  • No need to declare datatype of variables
  • Saves time in writing code but might give error at runtime

    A static language is a language that works like a dynamic language but with less effort, and this effort is writing code.

    In a static language, we have to write less code compare to a dynamic language.

The main point is:

In a static language, we can write and use variables without declaring them:

Example in Python

i = 12
print(i)

In a dynamic language, if we have to use variable, we have to declare it:

Example in C

int i;
int i=21;
printf(i)

List of languages

Each programming language has its own style, uniqueness and pros & cons.

list_of_programming_languages.png

Why Python

Python - It is a general purpose, object oriented and high level programming language.

  • Simple syntax

  • Very east to get started with

  • Supports different paradigm

  • Popularity (Facebook, Google, NASA, Quora, Amazon, Reddit, Netflix, Dropbox, Instagram are just to name a few companies which uses Python)

  • Community Support

  • Library Support ( 1,25,000 third party python libraries)

  • Job Markets

  • High Demand in AI and ML

    TIOBE Index for April 2021

trend.png

Some Quote About Python Programming

  1. The joy of coding Python should be in seeing short, concise, readable classes that express a lot of action in a small amount of clear code -- not in reams of trivial code that bores the reader to death.

  2. As it seems to me, in Perl you have to be an expert to correctly make a nested data structure like, say, a list of hashes of instances. In Python, you have to be an idiot not to be able to do it, because you just write it down. Peter Norvig

  3. Python is the "most powerful language you can still read". Paul Dubois

  4. Python is a truly wonderful language. When somebody comes up with a good idea it takes about 1 minute and five lines to program something that almost does what you want. Then it takes only an hour to extend the script to 300 lines, after which it still does almost what you want. Jack Jansen