Programming Basics and Computational Thinking
Course Learning Objectives & Reading Assignments
Core Learning Outcomes:
Describe the foundational elements of Computational Thinking.
Describe command line operation and hierarchical file system structures.
Create functional Python programs utilizing standard built-in functions.
Design and implement an algorithm capable of producing computer graphics and images.
Mandatory Reading Assignments:
"Introduction"
Downloading and Installing Python
"Chapter 19: Manipulating Images"
Computer Image Fundamentals
Assigned reading text: Automate the Boring Stuff with Python: Practical Programming for Total Beginners (2nd Edition) by Al Sweigart (No Starch Press). Over copies sold.

Program Development Cycle & Software Engineering Phases
Progression of Computing Concepts:
Software development progresses through a structured hierarchy: Natural Languages Algorithm Design Pseudocode / Flowcharts Programming Languages Compilation or Interpretation Machine Languages.
Initial Problem-Solving Workflow:
Step 1: Use Natural Language to formulate a human-understandable strategy for solving the problem.
Step 2: Construct an algorithm using formal Pseudocode or Flowcharts to define logic and execution paths.
Step 3: Translate the algorithmic design into an executable program using a target programming language.
Definition of the Development Cycle:
The sequence of activities followed during the creation, testing, and subsequent evolution of a software solution.
In introductory computer science contexts where software evolution is secondary, the cycle is treated as a linear sequence of distinct phases.
Phases of the Software Development Cycle:
Phase 1 — Analysis: Investigating and defining the problem requirements and constraints.
Phase 2 — Design: Architecting the algorithmic logic, data representations, and function structure.
Phase 3 — Implementation: Writing source code in the chosen programming language to implement the designed algorithm.
Phase 4 — Testing: Running the program across various inputs and environments to detect and fix errors.
Phase 5 — Maintenance: Updating and refining software to repair bugs, improve performance, or meet changing requirements.

Computational Thinking & Problem-Solving Methodologies
Definition of Computational Thinking:
A collection of problem-solving techniques specifically applied during the Design phase of the software development cycle.
The "Three A's" of Computational Thinking:
Abstraction: Isolating key principles and removing unnecessary complexities.
Automation: Formatting solutions into explicit, step-by-step procedures that can be executed automatically by a computer.
Analysis: Evaluating the performance, correctness, and efficiency of proposed solutions.
Detailed Elements of Abstraction:
Abstraction: Extracting only the relevant details needed to solve the problem while ignoring extraneous real-world specifics.
Decomposition: Splitting a complex software problem into smaller, independent subproblems. Frequently designated as the "Divide-and-Conquer" approach.
Pattern Recognition: Identifying similarities between current subproblems and previously encountered challenges to reuse verified solution patterns.
Practical Application of Divide-and-Conquer:
Deconstructing a master problem into easier subproblems allows each subproblem solution to be written as an independent function.
Because subproblem functions are modular, they can be reused across future projects.
Program execution across functions is coordinated by a single
main()function.
General Four-Step Problem-Solving Framework:
Step 1 — Understanding the Problem: Brainstorming, analyzing geometric, color, and algorithmic constraints before writing any code.
Step 2 — Devising a Plan: Creating pseudocode or flowchart visual diagrams.
Step 3 — Carrying Out the Plan: Translating the plan into concrete Python source code.
Step 4 — Looking Back: Executing, validating, and testing the program output against expected requirements.
Command Line Interfaces, File Systems, & System Navigation
Command Line and Terminal Functionality:
Testing software during development requires a Terminal or Command Prompt interface.
A Command Prompt serves as a text-based system entry point, enabling users to perform system tasks, run scripts, and manage files without relying on a Graphical User Interface (GUI).
Hierarchical File Systems:
Operating systems structure storage directories in a tree-like hierarchy.
Every running process maintains a single active location known as the Working Directory.
The root directory in Unix/Linux systems is represented by a single forward slash
/.Initial working directory upon launching a Terminal in a Virtual Linux Environment is
/home/student/, which contains standard user directories such asdesktopanddocuments.

Windows Command Prompt Navigation Commands:
dir: Lists all files and subdirectories contained in the current working directory.cd(without parameters): Prints the absolute directory path of the current working directory.cd <path>: Changes the current working directory to the target path provided.Relative Path
..: Refers to the parent directory located directly above the current working directory in the hierarchy.
Linux / Mac Terminal Navigation Commands:
ls: Lists all files and folders located in the current working directory.pwd: Prints the absolute path of the working directory (Print Working Directory).cd <path>: Navigates into the specified target directory.Relative Path
..: Represents the parent directory directly above in the directory hierarchy.
Python Execution Modes & Program Architecture
Python Interpreter Modes:
Interactive Mode:
Triggered by entering
pythonorpython3into the command line without arguments.Evaluates Python statements sequentially, one line at a time.
Designed for rapid prototyping, quick testing, and evaluating single expressions.
Normal (Script) Mode:
Triggered by entering
python(orpython3) followed by a script file name (e.g.,python script.py).Sequentially executes every line of source code contained within the specified file.
Modular Program Architecture:
Functions (Procedures): Self-contained blocks of code engineered to solve specific tasks.
The
main()Function:Acts as the primary entry point governing overall program execution.
While strictly enforced in languages like C, C++, and Java, employing a
main()function in Python is considered standard software engineering best practice.Code Commenting:
Essential requirement for all created source code programs.
Explains program structure, function purposes, and algorithmic logic to improve readability and maintainability.
Standard Library Functions, Formatted Output, & String Interpolation
Function Calling Syntax & Terminology:
To call (execute) a function, write the function name followed by pair of round brackets
().Values provided within the brackets are termed arguments.
Multiple arguments are supplied as a comma-separated list.
Built-in
print()Function:Produces textual output stream on the terminal screen.
Documentation reference:
https://docs.python.org/3/library/functions.htmlFormal Signature:
print(*objects, sep=' ', end=' ', file=sys.stdout, flush=False)Parameter Breakdown:
*objects: Variable positional arguments converted to text strings viastr()and printed.sep: Delimiter string placed between objects; default is a single space' '.end: Character string appended after all objects are printed; default is newline' '.file: Destination stream object (must have awrite(string)method); defaults tosys.stdout. Text mode stream required (cannot print to binary mode file objects).flush: Boolean flag specifying whether stream buffer is forcibly flushed; default isFalse. Added in Python version .Calling
print()with no arguments outputs only theendcharacter string.
Formatted Printing Examples:
Standard multi-argument print:
print("Hello", "World")producesHello World.Custom empty separator parameter:
print("Hello", "World", sep='')producesHelloWorld.Custom string separator parameter:
print("Hello", "World", sep='World.
String Interpolation via Formatted String Literals (F-Strings):
Created by placing an
forFimmediately before the opening quotation mark of a string.Variable names or Python expressions enclosed within curly brackets
{}inside the f-string are evaluated at runtime and replaced with their corresponding values.Comparison Example:
Given variable assignment
code = 1405.Without f-string prefix:
print('Welcome to COMP{code}!')producesWelcome to COMP{code}!.With f-string prefix:
print(f'Welcome to COMP{code}!')producesWelcome to COMP1405!.
Python Standard Library & Pseudorandom Generator:
Standard Library: A collection of built-in modules (files containing Python functions and classes) that extend Python capabilities.
Import Directive:
import randomloads the random module into the program space.random.randint(a, b): A function that accepts two integer parameters and and returns a pseudorandom integer fulfilling .
Algorithmic Problem Solving & Live Demonstration Projects
Case Study 1 — Dice Rolling Simulation:
Objective: Program a simulation of rolling unbiased, six-sided dice.

Decomposition into Subproblems:
Subproblem 1: Generate a pseudorandom integer within the inclusive range .
Subproblem 2: Display the generated integer to the user on the command prompt.
Mapping Subproblems to Existing Functions:
Subproblem 1 is solved using
random.randint(1, 6)from therandommodule.Subproblem 2 is solved using the built-in
print()function.
Demonstration Source File:
live_demo_01_roll_the_dice.py
Computer Graphics, Coordinate Systems, & Color Palettes
Case Study 2 — Artwork Reproduction:
Objective: Reproduce the abstract painting "Svanen (The Swan), No. 17" created by Hilma af Klint in 1915 using Python and the "Easy Graphics" library.

Demonstration Source File:
live_demo_02_hilma_af_klint.pyHigh-Level Deconstructed Process:
Step 1: Instantiate a display window configured to the target dimensions.
Step 2: Fill the window canvas background with the exact shade of red.
Step 3: Draw concentric semicircles layering inward using exact specified color shades.
Display Window Coordinate System:
The display window origin is anchored at the top-left corner of the screen.
The horizontal coordinate increases from left to right across the display width.
The vertical coordinate increases from top to bottom down the display height.
Exercise Canvas Specifications: Width = pixels, Height = pixels.
Center Canvas Coordinate: .

PICO-8 Standard Color Palette Reference:
Web Reference:
https://www.reddit.com/r/pico8/comments/hhxvgs/palette_viewer_with_correct_hex_values/Table of Color Indices, Names, and Hexadecimal Codes:
Index : BLACK (
#000000)Index : STORM (
#102B53)Index : WINE (
#7E2553)Index : MOSS (
#008751)Index : TAN (
#AB5236)Index : SLATE (
#5F574F)Index : SILVER (
#C2C3C7)Index : WHITE (
#FFF1EB)Index : EMBER (
#FF0040)Index : ORANGE (
#FFA300)Index : LEMON (
#FFEC27)Index : LIME (
#00E43B)Index : SKY (
#29ADFF)Index : DUSK (
#83769C)Index : PINK (
#FF77A8)Index : PEACH (
#FFCCAA)Index : COCOA (
#291814)Index : MIDNIGHT (
#111035)Index : PORT (
#422136)Index : SEA (
#125359)Index : LEATHER (
#742F29)Index : CHARCOAL (
#493338)Index : OLIVE (
#A28879)Index : SAND (
#F3EF70)Index : CRIMSON (
#BE1250)Index : CARROT (
#FF6C24)Index : TEA (
#ABE72E)Index : JADE (
#00E543)Index : DENIM (
#065AE5)Index : AUBERGINE (
#754665)Index : SALMON (
#FF6E59)Index : CORAL (
#FF9081)Important Caveat on Graphics Libraries: Not all colors present in external palette diagrams may be supported by a given library or environment; developers must thoroughly consult official library documentation.