Learn Fundamentals of
Computer Programming
Using Python

Sponsored by - Dreamcatcher IT

Venue - Premier University Chittagong

About me

CEO, Founder of Dreamcatcher IT


Pythonista, Javascript Enthusiast, Thinker, Day Dreamer, And an introvert with exception!


  • Former Software Engineer, Team Lead, RDS Solutions
  • ICT Certified@2014 Android  Application Development Trainer


to Computer Program

A  way to tell your computer to do things.


Dear Computer:
please, wash all the dishes

  • Browse web 
  • Show me a movie
  • Finish all my jobs before my boss arrives

How it works!








The act of entering Data into the computer


a series of actions or steps taken in order to achieve a particular end result.




Brewing Process Illustrated

  • start
  • grain
  • milling
  • mashing
  • boiling
  • cooling
  • fermenting
  • filtering
  • conditioning

Set of Steps/Actions


  • Finite set of steps or, processes to reach a specific outcome.
  • Unambiguous specification of how to solve a class of problems
Find Largest of two Numbers

1. Take Input A, B
2. Compare A with B
    1. IF A > B Then 
    PRINT A is Largest
    2. Else PRINT B Is Largest
a, b = 10, 400
largest = a if a>b else b




Difference Between Algorithm & Process

 The main difference is that, the process or Procedure can halt or need not halt. But the algorithm always halt and gives an output.


Any information that has been processed by a computer or similar device


a series of coded software instructions to control the operation of a computer or other machine.

print("Hello World")

example - Python Script to say Hello World

What is Python?

A Giant Snake, can be weighted upto 160kg

Python is a Programming Language!!

Actually An Interpreted Programming language like Ruby or, Java

Number of Programming Languages?

According to Wikipedia, there are 276 programming languages in the world and counting...

Which One Should I choose?

Go with Python!!

Top US Universities Uses Python

Top Companies that are using Python

  • General Purpose
  • Clean Syntax
  • Easy to Learn
  • Comprehensive Standard Library
  • Excellent Documentation
  • Open Source!

So Whats the big deal about Python?

Nerds might

complain Python is slow*!!

* interpreted language remember?

But there are ways to gain incredible performance boosts!

  • Cython
  • Jython
  • Numba

most of the time it doesn't matter!

What Matters most is the Developer's Time & Effort

Lines of Code for ASF XML Serialization:

  • C++ - 1580 Lines
  • Python - 130 Lines

Application Area of

Scientific Computing

  • SciPy - solves common scientific & engineering problems
  • NumPy - Matrix & Multidimensional arrays Manipulation
  • Matplotlib - Popular Plotting Libraries
  • Pandas - A handy tool for data processing
  • SymPy - Symbolic Math Libraries

Data Science

  • Machine Learning - PyTorch, Tensorflow, keras
  • Data Engineering - PySpark
  • Data Mining - Scrapy, aspyder 
  • Data Analysis - Pandas, Numpy,  
  • Data Visualization - Plotly, Matplotlib
  • Natural Language Processing - ScaPy, NLTK

Web Development

  • Frameworks- Django, Flask, Sanic, Zope, bottle
  • Task Queue - Celery
  • REST Frameworks - DRF, Flask , Falcon, Eve
  • Others - Json, BeautifulSoup, Selenium, Mechanize, asyncio, twisted, tornado

Computer Vision

  • Open CV
  • Pillow
  • Scikit-Image

Game Development

  • PyGame
  • SerpentAI
  • Blender
  • Panda3D

Embedded System

  • Raspberry Pi
  • Arduino
  • MicroPython

Desktop Application Development

Local Python Communities

I encourage you to join all of these Facebook Groups and, contribute by knowledge/resource sharing.


back in 30 minutes

Hello Python!

Lets get Interactive!


  • Type `python` in terminal or, just `py` if you are in windows 10 cmd
  • run python scripts:
        python your_script.py
  • run module:
        python -m some_module
  • run inline python:
        python -c "print(200)"

bonus  python -m http.server 4343

Basic Input & Output

# input takes an optional argument string
name = input("Enter your name")
print("Your name is", name)
# the name variable will be a string
a, b, c =  1, 2, 3
print(a,b,c, sep=" * ", end="")

this just a drop of the ocean! there are tons of ways to take inputs & outputs in Python. Explore them to know more about them!

Everything in Python is an Object!

Variables, Data Type, Conditionals

4  Data Types

  • int - Integer Numbers
  • float - Floating point numbers i.e decimals
  • str - string data type
  • bool - boolean data type (subclass of int)

Type Conversion

num = 10000
converted_string = str(num)
converted_num = int(converted_string)

  • int() - convert to integer with base
  • float() - convert to float
  • str() - convert to string

Variables & Data Types


number = 15

guess = int(input())

if number == guess:

    print("Great! Your guess is right")

elif number < guess:

    print("Your guess is greater than the number")


    print("Your guess is smaller than the number")
n = 100

age = 35.5

name = 'Tom'

output: <class 'int'>

output: <class 'float'>

output: <class 'str'>


# python supports multiple assignments
a, b, c = 1, 2, 3
# swap a with b
a, b = b, a
if a<b<c:
    print(c, "is largest")
# shortcut
a = b if b>c else c

Some simple string operations using built ins

my_string = "Hello World"

Basic python data structure

lists: l = [2, 5, 'a', 'google']

tuples: t = (3, 7, "a")

dictionary: d = {"name": "Bob", "age": 35}


list, tuple, dict

#list definition
my_list = [1,2,3,4,5]
# access last element
# reverse a list
# add an element
# insert element using index
my_list.insert(4, 2094)

# dictionary
d = dict()
d = {
    "key": "value",
     2: "another value",
    "string"; "this is a string",
# tuple
tuple = (1, 2, 3, 4, 5)
# Tuples are immutable
# can't insert element or remove from it

Loops, Iterators, Generators



Iterators are in python simply an object that can be iterated upon. 


for number in range(1,10):
    print(number, end=" ")

output: 1 2 3 4 5 6 7 8 9
i = 0
while(i < 10):
    print(i, end=" ")
    i = i + 1
num_list = [1, 2, 3, 4]

num_iter = iter(num_list)

For Loop

while Loop


a generator is a function that returns an object (iterator) which we can iterate over (one value at a time).

Example of Generators

  • map()
  • range()

Use Case of Generator

def first_n(n):
    returns a list of numbers from 0 to n
    num, numbers = 0, []
    while num < n:
        num += 1
    return numbers


Replace it with a shiny Generator!

# a generator that yields items instead of returning a list
def first_n(n):
    num = 0
    while num < n:
        yield num
        num += 1

List Comprehension

Concise way of creating list


[i for i in range(1,20) if not i%2]

output: [2, 4, 6, 8, 10, 12, 14, 16, 18]

Power of List Comprehension!

# Generate primes within 1-100
primes = [ i for i in range(2, 100) if 0 not in [i%j for j in range(2, i)] ]


  • organized block of code
  • reusable
  • do one thing, do it well
def addition(num1, num2):
        This function takes two values of
        num1 and num2 as parameter
        and will return their sum
    result = num1 + num2
    return result

Basic Approach Of Problem Solving

Step 1: Define the Problem

Step 2: Identify the key elements

Step 3: Plan the steps and, consider the difficulty or complexity of each step

Step 4: Find alternatives of the complex parts

Step 5: Start with the naive/minimal implementation

Step 6: Keep an eye on the Edges!

Step 7: Once solved try to improve the solution as much as possible


Solve these easy problems within next week!

You must start solving from the 'Say Hello World!' problem and, solve at least till the minion game problem if you need any help, post it here

Rather Simple Tasks!

Thank you!

All the images and logos in this slide are collected from Internet and, used only for educational purpose.