Always free. For everyone.
Course outline
Module 01 of 20 · Foundations

Your first Python program

Turn a reading, a formula, and a real question into working Python. This module has 3 lessons and takes about 1h. Each lesson has a practice exercise that runs real Python in your browser and a short quiz.

Start module 01 in the Learning Lab
LESSON 1 OF 3

Make Python say something

20 minEngineering
WHAT YOU WILL DO

Run your first program and give a measurement a useful label.

A program is a set of instructions. Python follows them from top to bottom. Press Run to try the example, then change a line and run it again.

print(...) displays what is inside the brackets. Put text inside matching quotes. Numbers do not need quotes. A comma lets print show several items on one line.

This is a fictional water pump test in Ibadan. The # symbol starts a comment for people reading the code. Python ignores the comment.

See it in action

example.pyPython 3
# Synthetic pump test, not a field measurement
print("Ibadan pump test")
print("Flow rate:", 12, "litres per minute")
print("Test complete")
Keep this in mind

Run a small change immediately. Fast feedback is how you learn to code.

LESSON 2 OF 3

Name values and keep the units

20 minEnergy
WHAT YOU WILL DO

Store values and calculate energy used by a device.

A variable is a name for a value. power_w = 80 stores 80 under the name power_w. Use clear names with underscores, and include units when they matter.

The * operator multiplies and / divides. Energy in watt-hours is power in watts multiplied by hours. Divide by 1000 to convert watt-hours to kilowatt-hours.

These synthetic readings describe a study room fan in Accra. Change hours and check whether the result changes as you expect.

See it in action

example.pyPython 3
# Synthetic study room example
power_w = 80
hours = 5
energy_wh = power_w * hours
energy_kwh = energy_wh / 1000
print("Energy:", energy_kwh, "kWh")
Keep this in mind

Write the units in your variable names and check the size of every result.

LESSON 3 OF 3

Build a useful calculator

20 minFinance
WHAT YOU WILL DO

Calculate a simple project budget with clear arithmetic.

Use + to add and - to subtract. Python multiplies and divides before adding and subtracting. Brackets let you choose a different order.

For this fictional student build, total cost is materials plus labour plus a percentage reserve. A percentage such as 10% becomes 10 / 100 in a formula.

round(value, 2) rounds a displayed number to two decimal places. These whole-number naira amounts are learning data. Later financial systems need a deliberate choice of money representation.

See it in action

example.pyPython 3
# Synthetic student project budget in NGN
materials_ngn = 18000
labour_ngn = 7000
reserve_rate = 10 / 100
base_ngn = materials_ngn + labour_ngn
total_ngn = base_ngn * (1 + reserve_rate)
print("Budget:", round(total_ngn, 2), "NGN")
Keep this in mind

Translate a real question into named inputs, one clear formula, and a labelled result.

ABOUT THE LEARNING LAB

Free, open and run by a nonprofit.

This page is part of Python to AI, a free course of 20 modules and 60 lessons in the engineering.fit( ) Learning Lab. The Learning Lab is built and run by engineering.fit( ), a nonprofit founded by Abdullateef Opeyemi Bakare that helps African engineering students gain research experience. You do not need an account or pay a fee to learn.

Course outline · Project lab · Visit engineering-fit.org