City University of Hong Kong · FACULTY OF INFORMATION TECHNOLOGY

IS5312 Analytical Programming with Python

- one subject, every graph, every model, every mark
6 Chapters31-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
The Complete Study & Assessment Guide · Semester A, 2026/27

IS5312 Overview

Analytical Programming with Python
— Trace the value, test the boundary, then explain the state change.
  • City University of Hong Kong
  • Semester A, 2026/27
  • Postgraduate course
  • Computer-based lab test
  • Information Technology

What this course asks you to do

IS5312 begins with no prior Python coding experience assumed and develops the ability to turn a problem statement into explicit data, control and output steps.

  • Assessment Attendance and in-class performance 10%, individual mini-project 25%, computer-based lab test 65%.
  • Terminal assessment The computer-based lab test takes place in week 14; no exact date or duration is stated.
  • Core method Trace values and types, test boundaries, then explain every state change.
  • Coverage Six teaching weeks from Python foundations through recursion and comprehensions.
Why read this guide

What you get in the full IS5312 Study & Assessment Guide

  1. 6 chapters, 31 pages — every assessed topic, week by week
  2. 19 original practice questions, each with a model answer
  3. 6 worked examples, solved the way IS5312 marks
  4. 7 computed figures, redrawn from the course’s own numbers
  5. Before-you-submit checklist for the Computer-based lab test (65%) — what markers reward, what costs marks

Free on this page: assessment table, chapter map, one worked example, key terms, FAQ. The rest is in the full study & assessment guide.

IS5312 · City University of Hong Kong
An independent, AskSia-authored study guide. AskSia is not affiliated with, endorsed by, or sponsored by City University of Hong Kong; the course code and name are used for identification only.
Assessment

How IS5312 is assessed

ComponentWeightFormat
Attendance and in-class performance10%Attendance and in-class performance
Individual mini-project25%Posted week 8, due week 12 Sunday, presentations week 13
Computer-based lab test65%Week 14

The published assessment statement lists three components whose weights total 100%. It places the computer-based lab test in week 14 and gives no exact date, duration, question format, permitted-materials rule or hurdle statement.

Assessment structure

10%25%65%Participation · Mini-project · Computer-based lab test

Segment widths reproduce the published weights and total 100%.

Other students are asking · IS5312

What other students are asking about IS5312

Where can I find lecture notes or study guides for IS5312 at CityU?
The IS5312 study guide in AskSia Library covers Analytical Programming with Python in 6 chapters, with the assessment table, a chapter-by-chapter topic map, key terms and a worked example, free to read on this page.
Is there a final exam in IS5312?
No final exam is listed in the offering this AskSia Library guide is built from; IS5312 is assessed by Attendance and in-class performance 10%, Individual mini-project 25%, Computer-based lab test 65%.
What does IS5312 cover on strings, lists and tuples?
In AskSia Library's IS5312 guide, the Strings, Lists and Tuples chapter explains indexing, slicing, methods, formatting, mutability, aliasing and nested sequences.
What does IS5312 cover on conditions and while loops?
In AskSia Library's IS5312 guide, the Conditions and While Loops chapter explains boolean expressions, branching, short-circuit evaluation, validation and loop control.
What does IS5312 cover on for loops, errors and files?
In AskSia Library's IS5312 guide, the For Loops, Errors and Files chapter explains range, nested iteration, error diagnosis, text files, writing, appending and CSV data.
Weights, dates and every chapter are set out with their sources further down this page.
Contents · every chapter, one map

What IS5312 covers

Six chapters move from Python numeric expressions and sequences through control flow, files, functions, mappings, recursion, generators and comprehensions.

01

Python Foundations and Numeric Expressions

numeric types, conversion, arithmetic operators, precedence, integer division and modulus

This chapter builds the first dependable Python workflow: identify a literal and its type, convert user input at the boundary, apply arithmetic operators in the correct precedence order, and verify mixed-unit results by reconstruction.

  • Integer and floating-point literals
  • Input and explicit type conversion
  • Arithmetic operators and precedence
  • Integer division and modulus
  • Rounding and reconstruction checks
In the full guide: 3 pages · 2 practice questions · 2 figures
02

Strings, Lists and Tuples

indexing, slicing, methods, formatting, mutability, aliasing and nested sequences

This chapter treats strings, lists and tuples as related ordered sequences while keeping their different meanings and mutation rules visible.

  • Positive and negative indexing
  • Slicing with start, stop and step
  • String methods, split and join
  • List mutation and sorting
  • Tuple immutability and list aliasing
In the full guide: 4 pages · 2 practice questions · 1 figure
03

Conditions and While Loops

Boolean expressions, branching, short-circuit evaluation, validation and loop control

This chapter builds control flow from Boolean expressions. Relational operators create conditions, logical operators combine them, branches choose actions, and while loops repeat while a condition remains true.

  • Boolean and relational expressions
  • If, elif and else branching
  • Logical operators and short circuiting
  • While-loop state and validation
  • Break, continue and loop else
In the full guide: 5 pages · 4 practice questions · 1 figure
04

For Loops, Errors and Files

range, nested iteration, error diagnosis, text files, writing, appending and CSV data

This chapter connects iteration with persistent data. It covers range objects, positive and negative steps, iteration across strings and collections, nested loops, and the different effects of pass, continue and break.

  • For loops and range boundaries
  • Nested loops and control statements
  • Syntax, runtime and logic errors
  • Text-file reading methods
  • Writing, appending and CSV transformation
In the full guide: 4 pages · 2 practice questions · 1 figure
05

Functions, Sets and Dictionaries

parameters, returns, scope, mutability, comprehensions, set relations and key-value mappings

This chapter treats functions as testable contracts with inputs, local state and returned outputs. It covers parameters and arguments, local and global scope, mutable versus immutable arguments, nested calls, default values and keyword arguments.

  • Function parameters and return values
  • Local scope and function calls
  • Mutable arguments and side effects
  • Set union, intersection and difference
  • Dictionary keys, values and items
In the full guide: 3 pages · 2 practice questions · 1 figure
06

Recursion, Generators and Comprehensions

base cases, reducing steps, yield, lazy evaluation and collection comprehensions

This chapter extends function design with recursion, lambda expressions, generators and comprehensions. A recursive solution must contain a direct base case and a reducing step that reaches it for every permitted input.

  • Lambda expressions and f-strings
  • Recursive base and reducing cases
  • Call-stack unwinding
  • Yield and lazy generators
  • List, set and dictionary comprehensions
In the full guide: 5 pages · 4 practice questions · 1 figure

The supported teaching sequence starts with numeric literals, input, conversion and operator precedence, then moves through strings, lists and tuples, Boolean decisions, while and for loops, file processing, functions, sets, dictionaries, recursion, generators and comprehensions.

The emphasis is operational: predict what a line does, trace how state changes, test boundaries and repair code whose syntax or logic is wrong.

How the assessment is structured

The published assessment statement assigns 10% to attendance and in-class performance, 25% to an individual mini-project and 65% to a computer-based lab test in week 14. It also describes weekly assignments as practice and review whose submission is not required.

The official course information for this offering does not state the lab-test duration, exact date, question structure or permitted materials.

This guide therefore prepares the transferable programming actions shown in the teaching sequence and does not invent a test format.

How to study with the chapters

Type every short example yourself, predict the output before running it and keep a hand trace for loops and recursive calls. Work the practice cards without looking at the model answers, then change the values and repeat.

A solution is not finished when it runs once: check empty input, zero, exact thresholds, one value on either side of a boundary, a missing key and a normal exhaustion path.

Worked example · free

Trace a validated total-seconds conversion

Q [8 marks]. The marks shown are an AskSia study allocation and are not the University marking scheme. Convert 7,385 seconds into hours, minutes and seconds, then reconstruct the original total as a check.
The conversion boundary matters.The conversion boundary matters. User input is a string, so a numeric calculation begins only after the program converts a valid text value to the required numeric type.Input arrives as text until conversion succeedsinput()string valuefor example, "42"int()number 42Adding text to a number raises TypeError.Strings concatenate or repeat; numbers calculate.
The conversion boundary matters. User input is a string, so a numeric calculation begins only after the program converts a valid text value to the required numeric type.
  • 3Find whole hours and the remaining seconds.
  • 3Find whole minutes and the final remainder.
  • 2Reconstruct the original total.
Integer division gives 2 whole hours and modulus leaves 185 seconds. Dividing that remainder by 60 gives 3 whole minutes, with 5 seconds left. Reconstruction gives 2 × 3,600 + 3 × 60 + 5 = 7,385, so the decomposition is internally consistent. The eight-point score is an independent AskSia study allocation and not a University marking scheme.
Sia tip — Reconstruct mixed-unit output in the original unit before trusting the display.
Glossary

Key terms

Boolean Condition
An expression that evaluates to True or False and controls a branch or repetition.
Integer Division
Division that keeps the whole-number quotient and discards the fractional remainder.
Modulus
An operator that returns the remainder after integer division.
Slice
A selected subsequence defined by start, stop and optional step values.
Mutable Object
An object whose contents can change in its existing memory location.
Short-circuit Evaluation
Stopping a compound Boolean expression once its result is already determined.
Accumulator
A variable updated repeatedly to collect a total or other running result.
Runtime Error
A failure raised when execution reaches an invalid operation.
Local Scope
The part of a function where its parameters and local variables are accessible.
Set Intersection
The collection of items shared by two sets.
Base Case
A recursive input whose answer is returned directly without another recursive call.
Generator
An iterable that produces values lazily and preserves state between yields.
FAQ

IS5312 FAQ

How is the course assessed?

Attendance and in-class performance contribute 10%, the individual mini-project contributes 25%, and the computer-based lab test in week 14 contributes 65%. The three published weights total 100%. These figures are the complete published weighting for the offering.

What is known about the computer-based lab test?

The official course information for this offering identifies a computer-based lab test in week 14. It does not state an exact date, duration, question structure or permitted-materials rule, so preparation should focus on the programming actions taught in the course.

Do the weekly assignments count toward the grade?

The assessment slide describes weekly assignments as practice and review, says submission is not required and states that suggested solutions will be provided. Use them to rehearse the problem types rather than treating them as another weighted component. They should still be completed independently before comparing them with any suggested solution.

What should I trace when code is wrong?

Write each variable value and type after the relevant line, then record the branch taken or the loop state after every iteration. Stop at the first point where the hand trace and program behaviour differ.

How should I prepare for Python sequence questions?

Practise positive and negative indexing, excluded slice stops, mutating versus non-mutating operations and the difference between aliasing and copying a list. Predict the original and copied values before running code.

What is the safest way to debug a loop?

State the initial state, condition, update and exit. Check that every repeating path makes progress toward making the condition false and that continue cannot skip the required update.

When should I use a set instead of a dictionary?

Use a set when unique membership or a set relation is the main question. Use a dictionary when a unique key must retrieve an associated value such as a score, label or nested record.

How can I check recursive code?

Test the base case first, then the smallest input that performs one reduction, then a normal input. Confirm that every permitted input becomes smaller and must eventually reach the base case.

Chapter questions

Questions students ask in each IS5312 chapter

Why does input need conversion?
The input function returns text, even when the characters are digits. Numeric calculation therefore requires an explicit conversion after validation. Validate the conversion before attempting arithmetic so the failure is diagnosed at the correct boundary. Chapter 01 · Python Foundations and Numeric Expressions
Why is the slice stop excluded?
Python includes the start position and stops before the end position, making adjacent slices meet without overlap. This convention lets adjacent slices meet at one boundary without selecting the same item twice. Chapter 02 · Strings, Lists and Tuples
When should I use elif?
Use elif when the categories are mutually exclusive and the first true condition should win. Put the narrowest or highest-priority category first and test every threshold explicitly. Chapter 03 · Conditions and While Loops
Why is the range stop missing?
Range stops before its stop argument, matching Python slice boundary behaviour. Write the first two generated values and step direction to verify the boundary before looping. Chapter 04 · For Loops, Errors and Files
Why should a function return instead of print?
A returned result can be tested, composed and formatted by the caller, while printed output is harder to reuse. Keeping presentation outside also lets several callers reuse the same calculated value differently. Chapter 05 · Functions, Sets and Dictionaries
What makes recursion terminate?
Every permitted input must move through the reducing step toward a base case with a direct answer. Test the base input, one reduction and a normal input to verify both termination and unwinding. Chapter 06 · Recursion, Generators and Comprehensions
Study strategy

How to prepare for the assessments

Work in short write-run-explain cycles. Before running code, predict the output and note every variable type. After running it, explain the first difference rather than editing several lines at once. Build a boundary checklist containing empty input, zero, the exact threshold, a value on each side, a missing key and a normal loop exhaustion.

For the computer-based lab test, rehearse starting from a plain-language requirement: state the data structure, write the stopping rule, separate reusable functions from input and display, and finish with one hand-computed check.

A+Everything unlocked
Unlocks this Bible + all 31 of your subjects at City University of Hong Kong, plus 1,000+ more Bibles across the AskSia library.
Sia - your IS5312 tutor, unlimited, worked the way the exam marks it
The full 31-page Bible + practice bank with worked solutions
Chrome extension - sync your LMS so Sia knows your deadlines
Bilingual EN / Chinese on every Bible and every Sia answer
$0.99 Trial
30-day money-back · cancel in one tap · how it works