PROGRAMMING / LOGIC / PROBLEM SOLVING

Think in steps.
Write in code.

Programming is about turning ideas into precise instructions. Learn how code makes decisions, repeats work, stores data, solves problems and becomes easier to improve.

Variables Conditions Loops Functions Algorithms
TRIVOX CODE LAB / challenge.py
01def find_max(values):
02  best = values[0]
03  for value in values:
04    if value > best:
05      best = value
06  return best
07
08print(find_max([4,12,7,21]))
OUTPUT 21
02 / FOUNDATIONS

Learn the language
behind every program.

Programming becomes easier when the basics are clear. Start with the ideas that appear in almost every language.

CORE IDEA Programming is a conversation between logic and data.

Variables hold information. Conditions make choices. Loops repeat work. Functions organise logic.

01VariablesRemember data
02ConditionsChoose paths
03LoopsRepeat work
04FunctionsReuse logic
03 / DECISION LOGIC

Teach the program
how to choose.

Conditions are the point where code stops being a sequence and starts making decisions.

QUESTION Is the score 80 or more?
score ≥ 80?
YES Excellent Run success path
NO Keep learning Run alternate path
04 / CODE READER

Read code like
a programmer.

Good programmers do not only write code. They can look at a block of code and understand what will happen before running it.

QUESTION TO ASK What value changes after each line?
01total = 0start
02for n in [2,4,6]:repeat
03  total += nupdate
04print(total)output
FINAL VALUE 12
05 / FUNCTION THINKING

One function.
One clear responsibility.

Learn how programmers reduce complexity by dividing a larger program into small reusable jobs.

INPUT price = 250
qty = 3
FUNCTION calculate_total() price × qty
RETURN 750
06 / MEMORY VIEW

See what the program
is remembering.

Track variables while the program runs. This makes debugging and logic much easier to understand.

VARIABLE WATCH LIVE STATE
name"Ravi"string
score86integer
passedTrueboolean
attempts3integer
07 / ALGORITHM THINKING

Solve the problem
before writing the syntax.

A strong solution begins with steps, not code. Learn to turn a problem into a simple algorithm first.

PROBLEM Find the largest number in a list.
1Assume first value is largest
2Compare each next value
3Replace when a larger value appears
4Return the final largest value
08 / DEBUG LAB

Learn to fix code
without guessing.

Debugging is a repeatable process: observe, isolate, correct and verify.

BUG REPORT TypeError
age = "19"

if age >= 18:
    print("Adult")
FIX age = int("19")
09 / PROJECT

Build one program
from idea to output.

Use variables, conditions, loops and functions together in one complete project.

PROJECT Expense Tracker

Enter expenses, calculate totals, group categories and show a simple summary.

Take user input
Store data in a list
Use loops for totals
Create helper functions
Print final summary
10 / RECURSION

A function can call
itself to solve smaller problems.

Recursion becomes simple when you see each call as one smaller version of the same problem.

FUNCTION
def countdown(n):
    if n == 0:
        return

    print(n)
    countdown(n - 1)
CALL 01countdown(3)
CALL 02countdown(2)
CALL 03countdown(1)
BASE CASEcountdown(0)
11 / DATA STRUCTURE OPERATIONS

See how data moves
inside a program.

Add, remove and access values while understanding what changes internally.

STACK PUSH / POP
task_1
task_2
task_3
Last in → first out
QUEUE ENQUEUE / DEQUEUE
A
B
C
First in → first out
12 / PERFORMANCE

Good code works.
Better code works efficiently.

Learn how the number of operations grows as the input becomes larger.

O(1) Constant
Fast
O(log n) Logarithmic
Excellent
O(n) Linear
Good
O(n²) Quadratic
Expensive
13 / READY TO CODE PROGRAMMING

Understand the logic.
Then make the computer follow it.

Start with fundamentals, build small programs and grow into real problem solving.

Start Programming