Computational Thinking & Python β€” File 1 of 5

Decomposition, patterns, abstraction, algorithms Β· Python syntax, data types, functions, files Β· 90 terms

Click a topic above to jump straight in ↑

🧠 Computational Thinking & Foundations

The problem-solving mindset behind all of computer science.

1

πŸ”‘ Core Concepts

Computer Science CORE

The study of computers, algorithmic processes, programming, computational thinking, computer systems, data, and the impact of computing on society.

Be able to describe CS as more than just coding β€” it includes data, systems, society and problem-solving.

Computational Thinking CORE

A problem-solving approach that uses ideas such as decomposition, abstraction, pattern recognition, logic and algorithms so that a solution can be automated or implemented by a computer.

Think of how a chef approaches a new recipe. They break it down into stages (decomposition), ignore irrelevant details like what colour plate to use (abstraction), notice that sauces always need similar steps (pattern recognition), and follow a recipe (algorithm). That's computational thinking in real life.

Decomposition CORE

Breaking a large or difficult problem into smaller, more manageable parts.

Building a house: instead of "build a house," you break it into: lay foundation β†’ build walls β†’ add roof β†’ install plumbing β†’ decorate. Each part is tackled separately.

Abstraction CORE

Ignoring unnecessary detail and focusing on the important features of a problem or system.

A map is an abstraction of the real world β€” it shows roads and landmarks but ignores the colour of buildings, the height of trees, or what's in shop windows. Only what matters for navigation is included.

Exam questions often ask: "What details are ignored in this model/diagram?" β€” that's testing your understanding of abstraction.

Pattern Recognition CORE

Identifying similarities, repeated structures or trends that can help solve a problem.

Spotting that every morning you wake up, brush your teeth, and have breakfast in the same order β€” that's a pattern. In coding, you notice that calculating an average always needs the same steps regardless of what data it is.

Generalisation CORE

Creating a solution that works for a whole class of similar problems, not only one specific example.

Instead of writing a recipe specifically for chocolate cake, you write a general "bake a cake" recipe that works for any flavour by changing the ingredients. Your solution generalises.

Algorithmic Thinking CORE

Designing a clear sequence of steps that can solve a problem.

Writing directions to your house: "Turn left at the church, go straight for 200m, turn right at the school…" Every step is specific, ordered and unambiguous β€” just like an algorithm.

Logic CORE

Reasoning about conditions that are either true or false, often using Boolean expressions and logic gates.

A bouncer at a club: "You can enter IF you are over 18 AND have ID." Two conditions, both must be true. That's Boolean logic with an AND.

Automation CORE

Using computing technology to carry out tasks with little or no human intervention.

A dishwasher automates washing up β€” you load it, press start, and it does the work. Similarly, a program can automatically send emails, process data, or control machinery.

Computational Artefact CORE

A digital product created using computing, such as a program, website, simulation, animation, app, data visualisation or embedded system.

Your LCCS coursework project is a computational artefact β€” make sure you can describe what yours does using this term.

Heuristic CORE

A rule-of-thumb or approximate problem-solving method used when finding the perfect solution would take too long or use too many resources.

If you need to guess how long a journey will take, you might say "about 30 minutes per 30km on a motorway" β€” that's a heuristic. It's not exact, but it's good enough and fast. Used in route-planning problems like the Travelling Salesperson Problem.

Model CORE

A simplified representation of a real-world system used to understand, predict or test ideas.

A weather forecast model isn't the actual atmosphere β€” it's a simplified mathematical copy. Scientists adjust variables and see what happens without needing to change real weather.

Simulation CORE

A computer-based imitation of a real process or system, often used to test what might happen under different conditions.

Flight simulators train pilots without using a real plane. The computer mimics real flight conditions β€” crashes don't hurt anyone. A pandemic simulation lets scientists test "what if we introduce a vaccine?" without risking real lives.

State CORE

The current condition or configuration of a system at a particular moment.

A traffic light has states: Red, Amber, Green. At any given moment, it is in exactly one state. Similarly, a game character can be in state "walking," "jumping," or "dead."

State Transition CORE

A change from one state to another caused by an input, rule or event.

The traffic light transitions: Red β†’ (timer expires) β†’ Green β†’ (timer expires) β†’ Amber β†’ (timer expires) β†’ Red. Each transition is triggered by an event.

Finite State Machine (FSM) CORE

A model made of a finite number of states and rules for moving between states based on inputs.

A simple vending machine is an FSM: states are "waiting," "item selected," "payment received," "dispensing." It moves between states based on inputs (button press, coins inserted).

Exam may show a state diagram and ask you to trace the final state given a sequence of inputs.

Turing Machine CORE

A theoretical model of computation using states, rules and a tape. It is used to reason about what can and cannot be computed.

Imagine an infinitely long paper tape and a robot that can read one symbol at a time, write a new symbol, and move left or right. Simple as it sounds, this model can in theory compute anything a modern computer can β€” it's the foundation of computer science theory.

Computable USEFUL

A problem is computable if an algorithm or machine can solve it in a finite number of steps.

Problem-Solving Process CORE

A systematic approach: investigate, plan/design, create, test/evaluate and iterate.

I Plan Carefully, Then Improve β†’ Investigate, Plan, Create, Test, Iterate.

Iteration (design process) CORE

Repeating and improving a solution based on testing, feedback or new requirements.

An artist sketches a draft, gets feedback ("nose looks wrong"), improves it, gets more feedback, and repeats. Each pass is an iteration. Note: this is different from a loop in code, though both involve repetition.

🐍 Python & Programming Basics

Variables, data types, loops, functions and everything Python.

2

πŸ“ Programs & Source Code

Program CORE

A set of instructions written in a programming language to make a computer perform a task.

Source Code CORE

The human-readable instructions written by a programmer before/while a program runs.

Script USEFUL

A program file, often a small Python program, that can be run by an interpreter.

IDE (Integrated Development Environment) USEFUL

Software used to write, edit, run and debug programs. Examples: IDLE, Thonny, VS Code.

An IDE is like a fully kitted workshop β€” it has the workbench (editor), tools (debugger), and a way to test your work (run button), all in one place. Writing code in a basic text editor without an IDE is like building furniture with just a knife.

Interpreter CORE

A program that executes high-level code, such as Python, by translating and running it line by line as needed.

Like a live interpreter at a United Nations meeting β€” they translate each sentence as the speaker says it, immediately. Python is normally interpreted.

Compiler USEFUL

Software that translates a whole high-level program into machine code or another lower-level form before it runs.

Like translating an entire book from Irish to English before publishing it. The whole translation happens first, then you read the finished book. Faster to run than an interpreter, but the translation step takes time upfront.

πŸ› Errors & Debugging

Syntax CORE

The rules for writing valid code in a programming language.

Just like English has grammar rules (capital letter at start of sentence, full stop at end), Python has syntax rules. Break them and the language won't understand you.

Syntax Error CORE

An error caused by breaking the grammar/rules of the programming language, so the code cannot run correctly.

Examples: missing colon after if, unclosed bracket, wrong capitalisation of True.

Logic Error CORE

An error where code runs but gives the wrong result because the algorithm or reasoning is incorrect.

You follow a recipe perfectly but accidentally used salt instead of sugar β€” the cake bakes fine (no syntax error!) but tastes terrible. The process ran, but the logic was wrong.

Runtime Error CORE

An error that occurs while a program is running, often because of invalid data or an impossible operation.

A car that starts fine (no syntax error) but breaks down mid-journey when you hit a pothole (unexpected condition at runtime). Example: dividing by zero, or accessing list index 10 when the list only has 5 items.

Bug CORE

A mistake or fault in a program that causes incorrect or unexpected behaviour.

Debugging CORE

Finding, understanding and fixing errors in a program.

Mention trace tables, print statements, and careful checking of output as debugging methods.

Comment CORE

Text in code for humans to read that is ignored by the computer when the program runs. In Python, single-line comments begin with #.

πŸ“¦ Variables & Data Types

Variable CORE

A named location/reference used to store a value while a program runs.

A labelled box. The label is the variable name (score), the thing inside is the value (42). You can replace what's inside the box at any time.

Value CORE

The item of data stored in a variable, such as 5, "hello" or True.

Assignment CORE

Giving a value to a variable. In Python this is done using =, for example x = 5.

Do not confuse = (assignment) with == (checking equality). Very common exam mistake!

Assignment Operator CORE

The = symbol in programming when it assigns the right-hand value/expression to the variable on the left. The right-hand side is always calculated first.

Expression CORE

A piece of code that evaluates to a value, such as x + 2 or len(names).

Operator CORE

A symbol or keyword that performs an operation on values, such as +, -, *, /, %, // or **.

% = modulo (remainder after division). // = integer/floor division. ** = power/exponent.

Operand USEFUL

A value or variable that an operator acts on. In x + 3, x and 3 are operands.

Operator Precedence CORE

The order in which operations are evaluated when there are multiple operators in an expression.

BIMDAS: Brackets, Indices (powers), Multiplication/Division, Addition/Subtraction β€” same as maths.

Integer CORE

A whole number data type, such as -3, 0, 5 or 255. In Python the type is int.

Float CORE

A decimal/floating-point number data type, such as 3.14 or -99.99. In Python the type is float.

String CORE

A sequence of characters used for text, usually written inside quotes, such as "Hello". In Python the type is str.

Phone numbers should be strings (not ints) if you don't need to do maths with them β€” otherwise leading zeros get cut off.

Boolean CORE

A data type with only two possible values: True or False.

A light switch is Boolean β€” it's either on or off, nothing in between.

Data Type CORE

A category of data that tells the computer what kind of value is being stored and what operations make sense.

Core Python types: int, float, str, bool, list.

Type Conversion / Casting CORE

Changing a value from one data type to another, such as int("5") or str(25).

input() always returns a string β€” you must cast to int or float if you need a number.

Input CORE

Data supplied to a program, system or algorithm β€” for example through the keyboard, a sensor or a file.

Output CORE

Data produced by a program, system or algorithm β€” for example text on a screen, a chart or a signal to an actuator.

print() CORE

A Python function that displays output on the screen.

print("Hello")
print("Score:", score, end="")
input() CORE

A Python function that reads text typed by the user and returns it as a string.

age = int(input("Enter your age: "))
Keyword CORE

A reserved word in a programming language with special meaning, such as if, else, while or def. Cannot be used as variable names.

Camel Case USEFUL

A naming convention where words are joined and later words begin with capital letters, e.g. houseNumber.

Thonny / IDLE / VS Code EXTRA

Examples of IDEs/editors commonly used for Python or web development in schools. Thonny and IDLE are beginner-friendly; VS Code is a professional editor. Tool names are not core syllabus definitions but useful to recognise.

Python Keyword List EXTRA

The full list of reserved Python words such as if, else, def, while, return. You don't need to memorise every keyword, but know they cannot be used as variable names.

πŸ” Functions

Argument CORE

A value passed into a function when it is called, such as 5 in print(5).

You order a pizza (call the function) and specify "pepperoni" (argument). The pizza place uses your specification to make the right pizza.

Parameter CORE

A variable listed in a function definition that receives an argument value.

Parameter = in the function definition. Argument = what you pass when you call it.

Function CORE

A named reusable block of code that performs a task and may accept parameters and return a value.

A function is like a microwave. You put food in (arguments), it does its thing, and gives you back heated food (return value). You can use the microwave over and over without rewriting "how to heat food" each time.

def greet(name):
  return "Hello, " + name
Return Statement CORE

A statement that sends a value back from a function to the code that called it, often ending the function.

Procedure USEFUL

A reusable block of code that carries out a task but is mainly used for its action rather than returning a value. In Python, usually just a function without a useful return.

Recursion CORE

A technique where a function calls itself to solve smaller versions of a problem.

Russian nesting dolls (matryoshka). To open the full set, you open the outer doll, which reveals a smaller doll, which you open again… until you reach the tiniest doll (base case) which doesn't open further.

Base Case CORE

The condition in a recursive function that stops further recursive calls.

Without a base case, recursion never stops β†’ stack overflow!

Recursive Case CORE

The part of a recursive function that calls the function again with a smaller/simpler problem, working towards the base case.

Stack Overflow USEFUL

An error that can occur when too many function calls are stored on the call stack, often from uncontrolled recursion.

πŸ”€ Selection & Iteration

Selection CORE

Choosing between different paths in an algorithm/program based on a condition, usually using if, elif and else.

Condition CORE

A Boolean expression used to decide whether a block of code should run. Example: if score >= 50:

If Statement CORE

A selection statement that runs a block of code only when a condition is True. Indentation is part of Python syntax.

Elif CORE

Python keyword meaning "else if"; used to check another condition after a previous if/elif is False.

Else CORE

A selection branch that runs when all previous if/elif conditions are False. Often used as the default case.

Iteration / Loop CORE

Repeating a set of instructions multiple times.

A washing machine drum spinning: it repeats the same rotation over and over until done. Each spin is one iteration.

For Loop CORE

A loop that iterates over a sequence or a range of values, often when the number of iterations is known.

for i in range(5):
  print(i)
While Loop CORE

A loop that repeats while a condition remains True, often when the number of iterations is not known in advance.

Stirring a pot of jam: you keep stirring while the jam hasn't set. You don't know how many stirs that will take β€” you just keep going until the condition changes.

Nested Loop USEFUL

A loop placed inside another loop. Useful for grids, tables and repeated repeated tasks.

Infinite Loop CORE

A loop that never ends because its stopping condition is never reached. Usually a logic error.

Sequence CORE

Executing instructions one after another in order. One of the three building blocks: sequence, selection, iteration.

πŸ“‹ Lists, Strings & Modules

List / Array CORE

An ordered collection of values stored under one variable name. Python lists use square brackets.

A numbered shopping list. Each item has a position (index). You can read, change or remove any item using its position number.

Element CORE

A single item in a list or array.

Index CORE

The position number used to access an item in a list or string. Python starts indexing at 0.

First item is at index 0, not 1. Trying to access index 5 in a 5-item list causes a runtime error (max index is 4).

Zero-Based Indexing CORE

A numbering system where the first item is at index 0, the second at index 1, and so on.

Slice CORE

A part of a string or list selected using start and stop indexes, such as name[0:2]. The stop index is not included.

len() CORE

A Python function that returns the number of items in a sequence such as a list or string.

append() CORE

A list method that adds an item to the end of a list.

Dictionary USEFUL

A Python data structure that stores key-value pairs.

Like a real dictionary β€” you look up a word (key) and get its definition (value). {"name": "Alice", "age": 17}

Tuple USEFUL

An ordered collection similar to a list but typically immutable (cannot be changed after creation).

Module / Library CORE

Reusable code that can be imported into a program to provide extra functions or tools.

Like downloading an app β€” instead of writing your own camera software, you import a library that already does it. Examples: random, math, pandas, matplotlib.

Import Statement CORE

A statement that makes code from a module/library available in your program. Example: from random import randint.

Random Value CORE

A value generated unpredictably within a defined range or set, often used in simulations/games.

String Concatenation CORE

Joining strings together using + or another method. Example: "Hello" + " " + "World"

String Replication USEFUL

Repeating a string using *, such as "Hi" * 3 gives "HiHiHi".

Escape Character USEFUL

A character sequence beginning with backslash used to represent special characters such as newline \n or tab \t.