CP1 · 14 weeks · Dr. Arif Solmaz
Computer Programming I
Learn Python through small engineering problems. Open a week, follow the examples, then try the notebook when the lesson asks you to.
Weekly lessons
| Week | Topic | Lesson |
|---|---|---|
| 01 | Describe a wheel’s travelColab Setup, Variables & Data Types | Open → |
| 02 | Report a measurement clearlyOperators, F-Strings & Type Conversion | Open → |
| 03 | Turn an operating rule into a decisionConditionals & Decision Making | Open → |
| 04 | Observe a signal over timefor Loops & range -- Repetition | Open → |
| 05 | Give a search a stopping rulewhile Loops, break & continue | Open → |
| 06 | Choose a useful summaryProblem-Solving Patterns | Open → |
| 07 | Keep the original observationsLists Fundamentals | Open → |
| 08 | Find a reading in a grid2D Lists & Nested Loops | Open → |
| 09 | Read a device messageString Processing | Open → |
| 10 | Convert a sensor reading into a forceFunctions — Basics | Open → |
| 11 | Use the same function with two sensorsScope & Mini-Library | Open → |
| 12 | Separate a missing reading from zeroError Handling | Open → |
| 13 | Save a report someone can checkFile I/O & CSV | Open → |
| 14 | Bring the sensor report togetherMini Project — Sensor Log Summary | Open → |
Course information & resources
Weekly notebooks are private practice. The midterm and final each contribute 50%.
Notebook & solution library
Week 01 · Colab Setup, Variables & Data Types
Week 01 · Describe and decide
Describe a wheel’s travel
Give one physical quantity a name, a value and a unit.
Explain how you obtained the distance, where the millimetre-to-metre conversion happens, and why wheel slip could change the actual travel.
Start Week 01 →Read the lesson and its examples on one page. Continue in Colab when you are ready to try them.
Notebook, solutions & practice reference
Python tools: Colab Setup, Variables & Data Types. 8 core / 7 optional exercises. Weekly notebooks are private practice.
Lesson in Colab Download notebook Worked solutions in Colab Download solutionsExercise list
| ID | Notebook exercise | Role |
|---|---|---|
| EX01 | Personal Info (Easy) | Core |
| EX02 | Rectangle Calculator (Easy) | Core |
| EX03 | Temperature Converter (Medium) | Core |
| EX04 | Speed Calculator (Easy) | Core |
| EX05 | Compound Interest (Medium) | Core |
| EX06 | BMI Calculator (Medium) | Core |
| EX07 | All Operations (Medium) | Core |
| EX08 | Circle Properties (Medium) | Core |
| EX09 | Ohm's Law (Easy) | Optional |
| EX10 | Power Calculation (Easy) | Optional |
| EX11 | Kinetic Energy (Medium) | Optional |
| EX12 | Pythagorean Theorem (Medium) | Optional |
| EX13 | Minutes Converter (Medium) | Optional |
| EX14 | String Operations (Easy) | Optional |
| EX15 | Engineering Report (Challenge) | Optional |
Week 02 · Operators, F-Strings & Type Conversion
Week 02 · Describe and decide
Report a measurement clearly
Turn a numeric result into a useful message.
Show a readable measurement message without letting display rounding change the inspection result.
Start Week 02 →Read the lesson and its examples on one page. Continue in Colab when you are ready to try them.
Notebook, solutions & practice reference
Python tools: Operators, F-Strings & Type Conversion. 8 core / 4 optional exercises. Weekly notebooks are private practice.
Lesson in Colab Download notebook Worked solutions in Colab Download solutionsExercise list
| ID | Notebook exercise | Role |
|---|---|---|
| EX01 | Operator Predictions (Easy) | Core |
| EX02 | Type Conversion Traps (Easy) | Core |
| EX03 | Seconds Breakdown (Medium) | Core |
| EX04 | Formatted Receipt (Medium) | Core |
| EX05 | Compound Interest with Input (Medium) | Core |
| EX06 | Currency Converter (Medium) | Core |
| EX07 | Temperature Table (Medium) | Core |
| EX08 | String Explorer (Easy) | Core |
| EX09 | Number Formatting (Medium) | Optional |
| EX10 | Grade Average (Medium) | Optional |
| EX11 | Electrical Calculator (Medium) | Optional |
| EX12 | BMI with Categories (Challenge) | Optional |
Week 03 · Conditionals & Decision Making
Week 03 · Describe and decide
Turn an operating rule into a decision
Make every combination of conditions have a clear outcome.
Explain an ENABLE or DENY result from the rule, including the exact threshold. This exercise models a decision; it does not implement a hardware interlock.
Start Week 03 →Read the lesson and its examples on one page. Continue in Colab when you are ready to try them.
Notebook, solutions & practice reference
Python tools: Conditionals & Decision Making. 8 core / 4 optional exercises. Weekly notebooks are private practice.
Lesson in Colab Download notebook Worked solutions in Colab Download solutionsExercise list
| ID | Notebook exercise | Role |
|---|---|---|
| EX01 | Positive, Negative, or Zero (Easy) | Core |
| EX02 | Even or Odd (Easy) | Core |
| EX03 | Grade Calculator (Medium) | Core |
| EX04 | Leap Year (Medium) | Core |
| EX05 | Ticket Price (Medium) | Core |
| EX06 | Triangle Validator (Medium) | Core |
| EX07 | Maximum of Three (Medium) | Core |
| EX08 | Season Classifier (Easy) | Core |
| EX09 | BMI Classifier (Medium) | Optional |
| EX10 | Quadrant Finder (Medium) | Optional |
| EX11 | Vowel or Consonant (Easy) | Optional |
| EX12 | Simple Calculator (Challenge) | Optional |
Week 04 · for Loops & range -- Repetition
Week 04 · Describe and decide
Observe a signal over time
Choose when to look, then explain what you actually observed.
List the times your program inspected and explain why an empty alarm log does not establish that nothing happened between samples.
Start Week 04 →Read the lesson and its examples on one page. Continue in Colab when you are ready to try them.
Notebook, solutions & practice reference
Python tools: for Loops & range -- Repetition. 8 core / 4 optional exercises. Weekly notebooks are private practice.
Lesson in Colab Download notebook Worked solutions in Colab Download solutionsExercise list
| ID | Notebook exercise | Role |
|---|---|---|
| EX01 | Print 1 to 20 (Easy) | Core |
| EX02 | Sum 1 to N (Easy) | Core |
| EX03 | Factorial (Medium) | Core |
| EX04 | Multiplication Table (Medium) | Core |
| EX05 | Count Even Numbers (Medium) | Core |
| EX06 | Sum of Odd Numbers (Medium) | Core |
| EX07 | Star Pattern — Right Triangle (Medium) | Core |
| EX08 | Star Pattern — Inverted (Medium) | Core |
| EX09 | Power Calculator (Medium) | Optional |
| EX10 | Fibonacci Sequence (Medium) | Optional |
| EX11 | Find All Divisors (Medium) | Optional |
| EX12 | Number Pyramid (Challenge) | Optional |
Week 05 · while Loops, break & continue
Week 05 · Describe and decide
Give a search a stopping rule
Repeat an action until an outcome is known.
Trace the search without an extra move, including when the switch activates on the fifth move.
Start Week 05 →Read the lesson and its examples on one page. Continue in Colab when you are ready to try them.
Notebook, solutions & practice reference
Python tools: while Loops, break & continue. 8 core / 4 optional exercises. Weekly notebooks are private practice.
Lesson in Colab Download notebook Worked solutions in Colab Download solutionsExercise list
| ID | Notebook exercise | Role |
|---|---|---|
| EX01 | Countdown (Easy) | Core |
| EX02 | Sum Until Zero (Easy) | Core |
| EX03 | Guess the Number (Medium) | Core |
| EX04 | Password Checker (Medium) | Core |
| EX05 | Digit Counter (Medium) | Core |
| EX06 | Digit Sum (Medium) | Core |
| EX07 | Reverse Number (Medium) | Core |
| EX08 | Collatz Conjecture (Medium) | Core |
| EX09 | Find First Divisor (Medium) | Optional |
| EX10 | Skip Multiples (Medium) | Optional |
| EX11 | Menu System (Challenge) | Optional |
| EX12 | Prime Checker (Challenge) | Optional |
Week 06 · Problem-Solving Patterns
Week 06 · Organise observations
Choose a useful summary
Decide what the report needs before calculating a statistic.
Choose and justify a summary that reveals the 8 A sample, and describe what it cannot tell us about unsampled moments.
Start Week 06 →Read the lesson and its examples on one page. Continue in Colab when you are ready to try them.
Notebook, solutions & practice reference
Python tools: Problem-Solving Patterns. 8 core / 4 optional exercises. Weekly notebooks are private practice.
Lesson in Colab Download notebook Worked solutions in Colab Download solutionsExercise list
| ID | Notebook exercise | Role |
|---|---|---|
| EX01 | Sum of Multiples (Easy) | Core |
| EX02 | Count Positive (Easy) | Core |
| EX03 | Find Maximum (Medium) | Core |
| EX04 | Find Minimum (Medium) | Core |
| EX05 | Average Calculator (Medium) | Core |
| EX06 | Count Above Average (Medium) | Core |
| EX07 | Second Largest (Medium) | Core |
| EX08 | Perfect Numbers (Medium) | Core |
| EX09 | GCD Calculator (Medium) | Optional |
| EX10 | Temperature Summary (Medium) | Optional |
| EX11 | Frequency Counter (Medium) | Optional |
| EX12 | Sensor Data Report (Challenge) | Optional |
Week 07 · Lists Fundamentals
Week 07 · Organise observations
Keep the original observations
Store a sequence so you can ask more than one question of it.
Find a maximum while preserving enough information to say when it occurred and what followed it.
Start Week 07 →Read the lesson and its examples on one page. Continue in Colab when you are ready to try them.
Notebook, solutions & practice reference
Python tools: Lists Fundamentals. 8 core / 4 optional exercises. Weekly notebooks are private practice.
Lesson in Colab Download notebook Worked solutions in Colab Download solutionsExercise list
| ID | Notebook exercise | Role |
|---|---|---|
| EX01 | Create and Print (Easy) | Core |
| EX02 | Sum a List (Easy) | Core |
| EX03 | Find Maximum (Medium) | Core |
| EX04 | Reverse a List (Medium) | Core |
| EX05 | Count Occurrences (Medium) | Core |
| EX06 | Remove Duplicates (Medium) | Core |
| EX07 | Even Numbers Only (Medium) | Core |
| EX08 | List Statistics (Medium) | Core |
| EX09 | Merge Two Lists (Medium) | Optional |
| EX10 | Swap First and Last (Easy) | Optional |
| EX11 | Rotate List (Medium) | Optional |
| EX12 | Grade Summary (Challenge) | Optional |
Week 08 · 2D Lists & Nested Loops
Week 08 · Organise observations
Find a reading in a grid
Keep the location attached to the value.
Report the peak as a temperature and a row–column pair. Explain why those indices are not physical distances.
Start Week 08 →Read the lesson and its examples on one page. Continue in Colab when you are ready to try them.
Notebook, solutions & practice reference
Python tools: 2D Lists & Nested Loops. 8 core / 4 optional exercises. Weekly notebooks are private practice.
Lesson in Colab Download notebook Worked solutions in Colab Download solutionsExercise list
| ID | Notebook exercise | Role |
|---|---|---|
| EX01 | Create a 3x3 Matrix (Easy) | Core |
| EX02 | Print Matrix Formatted (Easy) | Core |
| EX03 | Row Sums (Medium) | Core |
| EX04 | Column Sums (Medium) | Core |
| EX05 | Find Maximum Element (Medium) | Core |
| EX06 | Diagonal Sum (Medium) | Core |
| EX07 | Transpose (Medium) | Core |
| EX08 | Student Grades Table (Medium) | Core |
| EX09 | Matrix Addition (Medium) | Optional |
| EX10 | Flatten 2D to 1D (Medium) | Optional |
| EX11 | Temperature Grid (Challenge) | Optional |
| EX12 | Multiplication Table (Challenge) | Optional |
Week 09 · String Processing
Week 09 · Organise observations
Read a device message
Agree on the record format before extracting its value.
Explain which field is the value and which fields give it context, and reject an incomplete or unsupported message for a stated reason.
Start Week 09 →Read the lesson and its examples on one page. Continue in Colab when you are ready to try them.
Notebook, solutions & practice reference
Python tools: String Processing. 8 core / 4 optional exercises. Weekly notebooks are private practice.
Lesson in Colab Download notebook Worked solutions in Colab Download solutionsExercise list
| ID | Notebook exercise | Role |
|---|---|---|
| EX01 | Word Counter (Easy) | Core |
| EX02 | Vowel Counter (Easy) | Core |
| EX03 | Reverse a String (Medium) | Core |
| EX04 | Palindrome Checker (Medium) | Core |
| EX05 | Capitalize Words (Medium) | Core |
| EX06 | CSV Line Parser (Medium) | Core |
| EX07 | Character Frequency (Medium) | Core |
| EX08 | Acronym Generator (Medium) | Core |
| EX09 | Replace Digits (Medium) | Optional |
| EX10 | Email Validator (Medium) | Optional |
| EX11 | Log Parser (Challenge) | Optional |
| EX12 | Caesar Cipher (Challenge) | Optional |
Week 10 · Functions — Basics
Week 10 · Build a checkable report
Convert a sensor reading into a force
Give a reusable calculation a clear input and output.
Explain the function’s input, output and calibrated range, and distinguish a calculated extrapolation from a supported measurement.
Start Week 10 →Read the lesson and its examples on one page. Continue in Colab when you are ready to try them.
Notebook, solutions & practice reference
Python tools: Functions — Basics. 8 core / 4 optional exercises. Weekly notebooks are private practice.
Lesson in Colab Download notebook Worked solutions in Colab Download solutionsExercise list
| ID | Notebook exercise | Role |
|---|---|---|
| EX01 | Greet Function (Easy) | Core |
| EX02 | Area of Circle (Easy) | Core |
| EX03 | Celsius to Fahrenheit (Easy) | Core |
| EX04 | Max of Two (Medium) | Core |
| EX05 | Is Even (Medium) | Core |
| EX06 | Factorial Function (Medium) | Core |
| EX07 | Is Prime (Medium) | Core |
| EX08 | Power Function (Medium) | Core |
| EX09 | Count Vowels Function (Medium) | Optional |
| EX10 | List Average (Medium) | Optional |
| EX11 | BMI Calculator Function (Medium) | Optional |
| EX12 | Mini Calculator (Challenge) | Optional |
Week 11 · Scope & Mini-Library
Week 11 · Build a checkable report
Use the same function with two sensors
Make the information a calculation depends on visible.
Process A, then B, then A again and explain why A’s two results agree.
Start Week 11 →Read the lesson and its examples on one page. Continue in Colab when you are ready to try them.
Notebook, solutions & practice reference
Python tools: Scope & Mini-Library. 8 core / 4 optional exercises. Weekly notebooks are private practice.
Lesson in Colab Download notebook Worked solutions in Colab Download solutionsExercise list
| ID | Notebook exercise | Role |
|---|---|---|
| EX01 | Scope Prediction (Easy) | Core |
| EX02 | Fix the Scope Bug (Easy) | Core |
| EX03 | Temperature Library (Medium) | Core |
| EX04 | Math Helper Library (Medium) | Core |
| EX05 | String Helper Library (Medium) | Core |
| EX06 | Statistics Library (Medium) | Core |
| EX07 | Geometry Library (Medium) | Core |
| EX08 | Refactor — Inline to Functions (Medium) | Core |
| EX09 | Validator Library (Medium) | Optional |
| EX10 | Composition (Medium) | Optional |
| EX11 | Grade Report Generator (Challenge) | Optional |
| EX12 | Physics Calculator (Challenge) | Optional |
Week 12 · Error Handling
Week 12 · Build a checkable report
Separate a missing reading from zero
Keep a failed measurement from becoming believable data.
Keep valid zero and negative temperatures while distinguishing them from records that could not be measured or interpreted.
Start Week 12 →Read the lesson and its examples on one page. Continue in Colab when you are ready to try them.
Notebook, solutions & practice reference
Python tools: Error Handling. 8 core / 4 optional exercises. Weekly notebooks are private practice.
Lesson in Colab Download notebook Worked solutions in Colab Download solutionsExercise list
| ID | Notebook exercise | Role |
|---|---|---|
| EX01 | Catch Division Error (Easy) | Core |
| EX02 | Safe Integer Input (Easy) | Core |
| EX03 | Safe List Access (Medium) | Core |
| EX04 | Calculator with Error Handling (Medium) | Core |
| EX05 | Safe Division Function (Medium) | Core |
| EX06 | Validate and Convert (Medium) | Core |
| EX07 | Robust Average (Medium) | Core |
| EX08 | Temperature Converter with Full Validation (Medium) | Core |
| EX09 | Grade Entry System (Medium) | Optional |
| EX10 | Multiple Error Types (Medium) | Optional |
| EX11 | Retry Pattern (Challenge) | Optional |
| EX12 | Robust Data Processor (Challenge) | Optional |
Week 13 · File I/O & CSV
Week 13 · Build a checkable report
Save a report someone can check
Preserve the raw input and make the output reproducible.
Follow one accepted and one rejected record from the raw file to the saved outputs without overwriting the original evidence.
Start Week 13 →Read the lesson and its examples on one page. Continue in Colab when you are ready to try them.
Notebook, solutions & practice reference
Python tools: File I/O & CSV. 8 core / 4 optional exercises. Weekly notebooks are private practice.
Lesson in Colab Download notebook Worked solutions in Colab Download solutionsExercise list
| ID | Notebook exercise | Role |
|---|---|---|
| EX01 | Create and Read (Easy) | Core |
| EX02 | Count Lines (Easy) | Core |
| EX03 | Write a List (Medium) | Core |
| EX04 | Read Numbers (Medium) | Core |
| EX05 | Copy File (Medium) | Core |
| EX06 | Search in File (Medium) | Core |
| EX07 | CSV Reader (Medium) | Core |
| EX08 | CSV Writer (Medium) | Core |
| EX09 | Grade Report from CSV (Medium) | Optional |
| EX10 | Temperature Log (Medium) | Optional |
| EX11 | Append to Log (Medium) | Optional |
| EX12 | Data Cleaner (Challenge) | Optional |
Week 14 · Mini Project — Sensor Log Summary
Week 14 · Build a checkable report
Bring the sensor report together
Connect the steps and explain the result to another engineer.
Walk another person through the cleaned CSV, summary and one handled fault. Explain one limitation of the result using evidence from your own run.
Start Week 14 →Read the lesson and its examples on one page. Continue in Colab when you are ready to try them.
Notebook, solutions & practice reference
Python tools: Mini Project — Sensor Log Summary. 10 core / 2 optional exercises. Weekly notebooks are private practice.
Lesson in Colab Download notebook Worked solutions in Colab Download solutionsExercise list
| ID | Notebook exercise | Role |
|---|---|---|
| EX01 | Create and inspect the sample dataset (provided setup) | Core |
| EX02 | Read and Parse the CSV | Core |
| EX03 | Validate a Single Row | Core |
| EX04 | Clean the Data | Core |
| EX05 | Stats for One Sensor | Core |
| EX06 | Stats for All Sensors | Core |
| EX07 | Generate Summary Report | Core |
| EX08 | Write Clean CSV | Core |
| EX09 | Write Report to File | Core |
| EX10 | The Complete Program | Core |
| EX11 | BONUS — Date/Time Filtering (Challenge) | Optional |
| EX12 | BONUS — Sensor Comparison (Challenge) | Optional |