Introduction to
Programming with Python
Hussam Alafandi
Goals of this Course
Common Ground Establishing shared terminology, tools, and mental models.
Computational Thinking From plain text to flow charts, and finally into executable code.
Python Fundamentals Variables, loops, functions, and an introduction to OOP.
Working with Data Working with NumPy and Pandas—the core tools for Data Science.
Capstone: Complete Python Project Finish with a real-world project built end-to-end.
Today's Agenda
Introduction & Goals Introduction to the course and goals (this notebook)
Algorithms How to think about a problem step-by-step
Flow Charts Drawing the algorithm visually
Tools Python, Jupyter notebooks, Google Colab
6. Python Fundamentals Unit 2: variables, types, operators, I/O
7. Control Flow Unit 3: conditionals, loops
Algorithms & Programming
What is programming? Programming is telling a computer how to solve a problem in steps so
precise that a machine can follow them without guessing.
A Useful Mental Model
Problem Algorithm Flow Chart Code
Flow Chart: A visual picture including decisions and
Problem: What we want to solve, in everyday words.
loops.
Algorithm: A clear sequence of steps to solve it.
Code: Steps written in a language (like Python).
"The hard part is rarely the code. The hard part is thinking clearly about the steps."
What is an Algorithm?
Algorithm: A finite sequence of well-defined steps that solves a problem.
Properties of a Good Algorithm
Finite Unambiguous
It must end after a known number of steps. Each step has exactly one meaning.
Effective Has Input & Output
Each step can actually be performed. It takes something in and produces something useful.
Primality Test Algorithm
Problem: Checking if a given number 'n' is prime by searching for any divisors between 2 and n-1.
01 Input: Read a number n.
02 Base Case: If n < 2, it is NOT PRIME. Stop.
03 Initialize: Set divisor i = 2.
04 Iterative Search: While i < n:
● If n % i == 0, then NOT PRIME. Stop.
● Otherwise, increment i by 1.
05 Conclusion: If loop finishes, n is PRIME.
Flow Chart Symbols
Oval — Start / End
Parallelogram — Input / Output
Rectangle — Process / Action
Assignment, calculation, or specific task execution.
Diamond — Decision Yes / No)
Arrow — Direction of Flow
Example: Check Prime
Goal: Determining if a specific number is prime using the primality test algorithm.
View Interactive Board
Learning Materials
Interactive Flowchart Board Excalidraw)
[Link]
Python Colab Notebook: Part 1
[Link]
Python Colab Notebook: Part 2
[Link]
Resources
CS50's Introduction to Programming with Python
[Link]