Module 1 · Section 2 of 10
Lesson 1.1 - Why Python for Engineers
Target: ~8 min read - 15 min hands-on
Overview
If you've built a sprawling Excel workbook to process load combinations, size a feeder, reduce reactor logs, or track line output by hand, this course is for you.
Excel is fine for small, one-off tables, but it breaks down past a few thousand rows, or once you need to repeat the same analysis on next month's data, or combine data from several sources. MATLAB is powerful, but the licence costs money and it's not built for messy real-world data cleaning.
Python is free, used across every engineering discipline, and has libraries purpose-built for what we do: reading spreadsheets, doing statistics, running simulations, making charts. Examples in this course span structures, thermofluids, power, software systems, process plants, and manufacturing lines.
Why This Matters (PH Context)
Engineering firms across the Philippines expect junior engineers in every field to handle basic scripting - automating BOQ or load-schedule calculations, processing HVAC or SCADA sensor logs, pulling meter data for an energy audit, or reducing QC data on a production line. Python is free to licence, which matters for the many small and mid-size PH firms that can't justify a paid seat for every engineer.
Code-Along
# Lesson 1.1 - Your first Python program
# print() writes text (and values) to the output. Strings go in quotes.
print("Hello, future data-driven engineer!")
# Python evaluates arithmetic immediately - no setup, no compile step.
# Four quick one-liners, one from each of four engineering fields:
# [Civil] uniformly distributed load x span = total load on a beam
span_m, udl_kN_per_m = 6.0, 12.5 # assign two variables on one line
beam_load_kN = span_m * udl_kN_per_m
print("Beam load:", beam_load_kN, "kN") # print() takes several comma-separated args
# [Electrical] Ohm's law: current = voltage / resistance
voltage_V, resistance_ohm = 230.0, 46.0
current_A = voltage_V / resistance_ohm
print("Line current:", round(current_A, 2), "A") # round(x, 2) -> 2 decimal places
# [Chemical] ideal gas law PV = nRT solved for n (moles). *1000 converts kPa -> Pa
P_kPa, V_m3, T_K, R = 200.0, 0.05, 300.0, 8.314
n_mol = (P_kPa * 1000 * V_m3) / (R * T_K)
print("Moles of gas:", round(n_mol, 2), "mol")
# [Industrial] parts/min * 60 min/hr * hours = parts per shift
parts_per_min, shift_hours = 22, 8
parts_per_shift = parts_per_min * 60 * shift_hours
print("Parts per shift:", parts_per_shift)
Expected output:
Hello, future data-driven engineer!
Beam load: 75.0 kN
Line current: 5.0 A
Moles of gas: 4.01 mol
Parts per shift: 10560
Practice Exercises
- [Mechanical] Add a calc for fan shaft power: airflow
4.5m^3/s, pressure rise650Pa, fan efficiency0.72. Shaft power = airflow * pressure rise / efficiency. Print it in kW. - Write a single
print()statement that outputs your name, your engineering discipline, and today's date as one sentence. - Debug it:
print("Result:" current_A)has a syntax error. Find and fix it.
Try the exercises yourself before checking the solutions notebook.
# Try the practice exercises here
Knowledge Check
- What technology allows Python to run directly in the browser for this course? a) A remote server b) Pyodide (WebAssembly) c) A Docker container d) Google Colab
- Which of the following is not a reason to prefer Python over Excel for this course? a) Handles large datasets better b) Free to use c) Requires no programming d) Reusable across projects
- True or False: You need to install Python on your computer to complete this course.
Answer key
- b) Pyodide (WebAssembly)
- c) Requires no programming
- False
2 / 63 sections · Course home · Join the coaching cohort