WBCHSE Applied AI study materials
WBCHSE Applied AI study resources

WBCHSE Applied AI: Computational Thinking and Python Programming Fundamentals

WBCHSE Applied AI · Work through your exam, one topic at a time.

All guide sections

Computational Thinking and Python Programming Fundamentals

Domain 3 - Computational Thinking and Python Programming Fundamentals. This domain tests decomposition and abstraction as much as syntax: can you read a short program, trace its state line by line, and predict the exact output?

Core rules and concepts

  • Four pillars: decomposition, pattern recognition, abstraction, algorithm design. A valid algorithm must be unambiguous, finite and produce output for valid input.
  • Types: int, float, str, bool, list, tuple, dict, set. Use type() to confirm; int('7'), float('2.5'), str(7) convert. input() always returns a string.
  • Operators: / is true division (float), // is floor division, % is remainder, ** is power. Precedence runs **, unary minus, * / // %, + -, comparisons, not, and, or.
  • Control flow: if / elif / else, for over iterables, while with a condition that changes. Blocks are delimited by indentation, not braces. range(a, b) stops before b.
  • Functions: def name(params): with return; a function with no return yields None. Parameters are local names, but mutating a list argument changes the caller's list.

Worked example

total = 0
for n in range(1, 6):
    if n % 2 == 0:
        total += n

Trace with state: range(1, 6) yields 1, 2, 3, 4, 5. n=1 is odd, skipped. n=2 even, total=2. n=3 skipped. n=4 even, total=6. n=5 skipped. The loop ends and the program prints 6. Notice that 6 (the stop bound) is never processed.

Traps that cost marks

  • Forgetting that range excludes its stop value.
  • Confusing = (assignment) with == (comparison).
  • Writing 7/2 when the answer needs 7//2; in Python -7 // 2 is -4, not -3.
  • Expecting 0.1 + 0.2 == 0.3 to be True; floating point gives 0.30000000000000004.
  • Adding a string to an integer ('3' + 2) raises a TypeError; convert first.