Start here
Choose an example. Predict its output, then use either conversion button. Edit the design, convert it to Python and test it in IDLE. Pseudocode explains the algorithm; Python implements it. Go to the editors.
The core notation follows Appendix B, Notes 2β3, with input and loop examples from the Unit 1 teaching guidance. This is an independent practice tool, not an official marking or execution system.
Converter
Both editors are editable. Converting replaces the other editor. Code stays in this browser and is not run or uploaded. Use spaces for Python indentation.
Predict, trace, test, refine
| Test kind | Data / setup | Expected result or issue to investigate |
|---|
In OneNote, add columns for actual result, pass/fail and refinement with a reason. Run the tests in IDLE, record evidence and explain any differences.
How this supports Unit 2
- 2.1 Investigation: identify inputs, outputs, constraints and success criteria; split the problem into routines before converting.
- 2.2 Design: document data and interfaces; write pseudocode for validation, verification, authentication and processing. A Python listing does not replace the design.
- 2.3 Implementation: develop and annotate Python functions, control flow, strings, data structures and files. Extend routines and build the real interface in IDLE.
- 2.4 Testing, refinement and evaluation: predict typical, extreme and erroneous tests, compare outcomes and justify improvements.
Tkinter and the wider practical work
The converter handles callback logic, not Tkinter widget declarations. The following original example connects the βGUI callback logicβ routine to an Entry, Button and Label. Design the interface first, then combine this with check_name in IDLE.
import tkinter as tk
window = tk.Tk()
window.title("Presence check")
name_entry = tk.Entry(window)
name_entry.pack()
feedback = tk.Label(window, text="")
feedback.pack()
def on_check():
message = check_name(name_entry.get())
feedback.config(text=message)
tk.Button(window, text="Check", command=on_check).pack()
window.mainloop()
Interface design: when the button is pressed, read the entry, call the checking routine and display its returned message. In IDLE, test keyboard focus and empty text, and annotate the callback.
Also practise modules, frames, widgets and geometry managers; fixed-length records; wider validation techniques; debugging and changes to supplied code. Use the Python 3/IDLE version specified by the pre-release and examination instructions. These examples are not the live assessment scenario and do not cover all Unit 2 requirements.
Unit 2 Guidance for Teaching, pp. 6β14 Β· Unit 2 sample assessment materials
Notation reference
Keywords are shown in the WJEC style. The converter accepts mixed-case pseudocode keywords. Variable names remain case-sensitive, as in Python.
| Purpose | Python | WJEC-style pseudocode |
|---|---|---|
| Declare a type | Types belong to values | mark is integer |
| Assignment | mark = 12 | set mark = 12 |
| Output / input | name = input("Name: ") | name is string output "Name: " input name |
| Selection | if mark == 12: print(mark) | if mark = 12 then output mark end if |
| Counted loop | for i in range(1, 6): print(i) | for i = 1 to 5 output i next i |
| Conditional loop | while count > 0: count = count - 1 | while count > 0 set count = count - 1 repeat |
| Subroutine | def greet(): print("Hello") greet() | Declare greet() output "Hello" End Subroutine call greet() |
| Equality / inequality | == / != | = / <> |
| Logic and values | and / or / not True / False | AND / OR / NOT / XOR TRUE / FALSE |
| Whole-number division / remainder | // / % | DIV / MOD |
| Indexed item | marks[0] | marks[0] |
| Length / trim | len(name) / name.strip() | len(name) / trim(name) |
| Substring | name[0:3] | mid(name, 1, 3) |
| Comment | # Explain why | /** Explain why */ |
Loop bounds: WJEC to includes the final value; Python range excludes its stop. The converter adjusts this in both directions, including constant negative steps. It also accepts end while, as used in the teaching guidance, and repeat ... until. An until loop stops when its condition becomes true.
Types and positions: declare a type before pseudocode input. Python declarations become comments; integer/real input uses int/float. Ordinary list indices and classroom slices start at zero. mid starts at one, as illustrated in the sample assessment. Use non-negative substring lengths and valid positions. instring(start, text, search) also uses one-based positions and returns zero when absent. A character is a one-character Python string; add a length check.
Classroom notation and conversion limits
Appendix B is a set of conventions, not a complete executable language. We explicitly extend it for parameters and returned values, container literals, for each, explicit loop steps and the following operations. These are teaching choices, not extra official WJEC keywords.
text(value)converts to a string;digits_only(text)matches Pythonisdigit();ascii_only(text)matchesisascii(). Together they check for ordinary digits 0β9, not all valid Python integers.upper,lower,containsandfind_indexdescribe common operations.slice(sequence, start, stop[, step])uses Python's zero-based, stop-exclusive bounds. It is deliberately distinguished frommid. List, tuple and dictionary literals describe initial contents, rather than a WJEC array-size declaration.open source from "data.txt" for reading,read_line(source),read_lines(source),call write_text(destination, text),call write_lines(destination, lines)andclose sourcepreserve file handles and newline characters. Writing mode overwrites a file; appending mode adds to it.valhere converts a valid number string to a real number. It is not Visual Basic's prefix-parsing function. Numeric conversion still needs suitable validation. Prompts are represented by separate output and input instructions.
Supported: short single-line expressions, nested selections/loops, named subroutines, returns, basic string/list/dictionary operations and text files. Not supported: imports, classes, Tkinter declarations, exceptions, comprehensions, f-strings, multiline expressions, arbitrary methods or automatic array allocation. Unsupported input clears the destination and explains the first problem. A rejection means the tool cannot translate it; the code or pseudocode may still be valid.
This tool does not run code or check every syntax, type or logic error. It is not a mark scheme or a full translator. Trace conditions, types, bounds and data handling, and test in IDLE. For negative operands, Python's floor division/remainder rules are retained; use non-negative operands for introductory DIV/MOD examples.