Introduction to Programming for Non-Programmers (using Python)

Audience

  • Individuals who would like to learn the principles of computer programming.
  • Uses Python as an introductory language.

Prerequisites

  • None

Goals

  • Learn to think programmatically
  • Understand basic data structures
  • Understand basic control loops
  • Solve numerous practical programming examples

Duration

  • 3 Days

Syllabus

Welcome and Introductions

  • Introduction to the instructor
  • Delegate introductions
  • Course overview
  • Questions

Introduction to Python and Coding Setup

  • What is Python
  • Common uses for Python
  • How Python programs work
  • Running a Python program
  • REPL (Read-Eval-Print Loop)
  • IDEs: PyCharm, VS Code, Spyder
  • Jupyter Notebooks
  • Python Hello World

Lab 1: Setting up a Python Project


Solving Problems with a Computer

  • Problem Decomposition
  • Abstraction & Modeling (e.g., London Underground Map)
  • Logical and Algorithmic Thinking
    • What is an Algorithm
    • Example: How to book a holiday
    • Evaluation or Testing of Solutions

Lab: Algorithmic Thinking

  • Exercises in teams (2-3 people):
    • How to get to the cafeteria
    • Smiley Face Exercise
    • Chicken, Sack of Corn, and the Fox River Crossing

Variables and Values

  • Variables, Symbol Names, and Values
  • Variable declarations
  • Naming conventions
  • Variable values
  • Numerical Data Types in Python
    • Integers
    • Floating-point numbers
    • Arithmetic operations

Lab 3: Working with Numbers


Strings

  • String operations
  • Converting numbers to strings
  • Basic string formatting

Lab 4: Working with Strings


Flow of Control

  • Conditional statements
    • if, if-else, if-elif
    • Boolean Logic

Lab 5: Number Guess Game Part 1 – Using Conditionals


Loop Constructs

  • Counted Loops (for loop)
  • Conditional Loops (while loop)

Lab 6: Number Guess Game Part 2 – Working with Iterations


Functions

  • Abstracting logic
  • Defining functions
  • Calling functions
  • Parameter passing
    • Default parameter values
    • Mandatory and optional parameters
    • Named parameters
  • Returning values

Lab: Organizing the Number Guess Game Using Functions


Sequential Data Containers

  • Mutable and Immutable types
  • Tuples
  • Lists

Lab: Using a List to Record Guesses in the Number Guess Game


Advanced Data Containers

  • Sets
  • Dictionaries

Lab: Adding User High Scores to Number Guess Game Using a Dictionary


File I/O

  • Obtaining a file reference
  • File access modes
  • Reading from a file
  • Writing to a file
  • Using with for file handling
  • Simple exception handling
  • Renaming and deleting files

Lab: Logging Program Start-up and Results in a File


CSV Module

  • Introduction to Modules
  • CSV module
  • Reading CSV data from a file
  • Writing data to a CSV file

Lab: Store Usernames and Best Guess Scores in a CSV File