Take a grade: Python (2023)
- Complete beginner? Not sure what to do? Start with grade 1.
- If you have previous experience, register for the grade whose core concepts most closely match your current level.
- Once registered, start your project and show you meet the requirements of the grade. Not sure what to do? Start here and get creative.
When you have a first draft of your project with working code, submit it for assessment. A supportive code mentor will help you reflect, refine and revise it before giving your marks (based on the final revised version of your project). Remember, grades are cumulative: you should understand and demonstrate the core concepts from previous grades.
Available grades:
Grade 1 (Initial)
Grade 1 is suitable for those with absolutely no previous experience of programming.
Core concepts
- Assignment: an understanding that the name on the left of an
=
symbol is assigned the value on the right of the=
symbol. - Basic types: a basic familiarity with strings (
str
), integers (int
), floats (float
) and boolean (bool
) types. - Simple arithmetic / numeric operations: correct use of:
<
,>
,>=
,<=
,==
,!=
,+
,-
,*
,/
and%
arithmetic operators. - Simple program control flow: use of
if
/else
,while
andfor i in range(x):
along with an understanding of indentation to define scope of related code blocks. - Basic input and output (IO): use of the
print
andinput
built-in functions, basic event handling in games, or simple sensor readings or hardware based signals (if making a hardware based project). - Simple commenting and/or informal documentation: demonstrates use of the
#
symbol to add commentary to code. Shows an understanding of triple-quoting at the start of files to describe the contents therein. - Basic REPL use: can explain the R, E, P and L concept, understands the built-in
help
anddir
functions for exploring Python from within the REPL. - Random selection/integers: use of
random.choice
andrandom.randint
to generate random values. NOTE: the candidate need not understand why they need toimport random
at the start of their script. - Lists: creation of new lists (
my_list = [1, 2, 3, 4]
), use of simple list-related methods / functions (append
,remove
,del
,insert
,len
), membership (x in my_list
) and access by index (my_list[3]
). - Code review: can explain the difference between a syntax error and a runtime error. Makes use of their IDE's linting features to reveal syntactic problems in code. Reads and understands code flow and state in order to reason about and fix code under review.
- Simple imperative structure: an understanding of how execution of the code moves in a step wise ("through composed") manner. NOTE: the definition and calling of functions is first addressed in grade 2.
Grade 2 (Elementary)
Grade 2 is suitable for those with a little experience of programming, or for absolute beginners who can quickly move beyond the requirements for grade 1.
Core concepts
- Import modules ~ a basic familiarity with the concept of a module, how to use the
import
statement and the difference betweenimport foo
andfrom foo import bar
. They should also be familiar with theas
keyword for aliasing imported names:from foo import bar as baz
. - Functions ~ an understanding of how to call and define functions, how to assign/return the result of a function call, how to pass in and define arguments to a function and how to document such code.
- Data validation ~ values are checked and simple error conditions are handled appropriately. Values may also be normalised (for example, making a string all upper case) and, in the case of a string, use of
in
may be used to confirm the existence of a substring. - Logical operators ~ an understanding of the logical
and
,or
andnot
operators as well as knowledge of how to use parenthesis ((
and)
) to define/clarify order and precedence of evaluation. - Program control flow ~ use and clear mental models of
for
,if ... elif ... else
,while
,break
andcontinue
for program flow, including potential examples of nested uses. - Dictionaries ~ creation of new dictionaries (
my_dict = {'a': 1, 'b': 2}
), use of simple dict-related methods / functions (del
,len
,get
), membership (x in my_dict
), getting/setting by key (my_dict['c'] = 3
) and iteration (for key, value in my_dict.items()
). - Basic string operations ~ using f-strings, string methods (
len
,join
,split
,upper
,lower
,startswith
,endswith
,isnumeric
etc). - Simple slicing ~ can explain and demonstrate simple slicing operations: getting the first or last n items from a list or string.
- Documentation ~ Inclusion of a
README.txt
file outlining the name, reason for and execution of code. Comments found in code explain intention and clarify programming decision making. - Debugging ~ can use a simple visual debugger to step through code, explore branching and interrogate the state of the program.
Grade 3 (Lower)
Grade 3 is the first "core" grade where fundamental concepts are rigorously covered at an introductory level. Candidates must be familiar with simple coding environments such as Mu, although we encourage confident learners to graduate to more advanced editing tools.
Core concepts
- Core data structures ~ a familiarity with lists, dictionaries, sets, bytes and string data. This should include an appreciation of when and how to use them as well as knowledge of methods associated with each type. Use of such types should also be idiomatic via evidence of iteration, slicing and other legitimate and useful programming techniques associated with such structures.
- Functions ~ define functions (with docstrings) that can handle
*args
and**kwargs
as well as named arguments with default values. Candidates should show understanding of why it's bad to use mutable data as default function argument values. They are able to call functions defined in such a way. - Multi-file project structure ~ the source code for the project is in its own directory. The source is spread between appropriately named and scoped modules.
- Documentation ~ supporting files such as
README
,LICENSE
,AUTHORS
andCODEOFCONDUCT
are in the root directory of the project and contain appropriate material (for example, theLICENSE
contains a recognised FLOSS license, or theCODEOFCONDUCT
is based upon a recognised and trusted source such as the PSF's own code of conduct). Furthermore, candidates should demonstrate an understanding of why such files are important. - Exception handling ~ an understanding of how to correctly use
try
,except
andfinally
for appropriate exception handling. Candidates should also demonstrate they canraise
exceptions when the situation is apt, and understand the nature, choice and use of the built in exceptions that come with Python. - Reading and writing files ~ candidates have clear mental models of how the file system works and how Python interacts with it. They can idiomatically open files to read, write and append (using the
with
statement, although context handlers are fully addressed in a later grade), and navigate around the file system (change directories, create and remove directories, copy, move and delete files). - Simple Internet ~ basic use of modules such as requests to make simple calls across the Internet to gather or push data to/from APIs. Candidates should demonstrate a basic understanding of HTTP's client/server model and the GET, POST, PUT and DELETE request types.
- Simple source control with GIT ~ candidates are able to use
git
to initialise a repository (git init
) and create a series of commands (git add
,git rm
,git mv
,git checkout
andgit commit
) which show the history of the development of the project. They can interrogate git at a basic level withgit status
andgit log
. They understand the core concepts of a commit and a repository as well as being able to explain why one might use version control.
Grade 4 (Intermediate)
Grade 4 is the second "core" grade where fundamental concepts are rigorously covered at an introductory level. In grade 4 candidates should clearly show fluency, depth of knowledge and confidence at integrating the core skills, concepts and practices covered so far.
Core concepts
- The Standard Library ~ candidates should be familiar with the notion of the standard library. They are able to give examples and illustrations of modules, features and capabilities found within the standard library. They demonstrate understanding of how to explore, research and make use of Python's own documentation about the standard library.
- Built-ins ~ candidates should be familiar with the notion of built-in functions and give examples and illustrations of several such functions and their appropriate use. Furthermore, they understand where to find the documentation relating to built-in functions and show they are able to make sense of such technical documentation.
- List Comprehensions / Generator Statements ~ the candidate understands the difference between lazy and eager evaluation. They can demonstrate effective use of such statements and explain the mental model associated with how they work. Furthermore, they show understanding of when using a loop rather than such a statement may be more desirable.
- Types ~ there is evidence of understanding of the mental model that everything in Python is an object which has a type (that defines the available attributes and methods of the object). Candidates show a basic understanding that classes define types of things, and objects are instances of classes. They are able to use and explain the built-in functions:
isinstance
,hasattr
,getattr
,setattr
effectively. - Data storage ~ demonstrate or show a simple understanding of at least one sort of data storage technology. This could be a key/value store (for example, Redis), a document store (like MongoDB) or a relational database (such as PostgreSQL or SQLite). Only simple CRUD like operations need be understood or demonstrated. However, candidates should be able to explain the advantages, benefits and costs of using a datastore. It is expected that candidates will use an existing Python module for interacting with the data store and may not need to know details of the underlying API (such as that the data is JSON serialised).
- Unit tests ~ the candidate uses a test framework (such as PyTest or the built-in Unittest module) to create and run simple/basic unit tests. They are able to explain the reasons for unit testing and describe the core concepts of test driven development (TDD), even if they don't practice it themselves.
- PDB/REPL ~ the candidate is able to use the core functionality of the Python Debugger (PDB) from the command line, or an equivalent tool built into their development environment. This may include core tasks such as setting a breakpoint in code, stepping in/out of a block of code, continuing to the end of a loop and evaluating the values of objects in scope in the REPL like interface with which they are presented.
Grade 5 (Higher)
Grade 5 completes the core category of grades. By passing this grade candidates will have demonstrated they understand and make use of all the core concepts of Python at a basic level. Candidates at this level should explore how all the core concepts and knowledge fit together and make a coherent whole.
Core concepts
- Basic Object Orientation ~ candidates create and instantiate their own classes, understand the purpose and usage of
__init__
, whatself
refers to, can explain the difference between an attribute and a method while also showing appropriate use of classes and objects within their own code. - Data serialisation ~ candidates show a familiarity with JSON and CSV data serialisation (or similar) along with the related modules in the standard library. They can explain the different use cases for each standard (for instance, unstructured vs tabular/structured data).
- Context handlers ~ they understand the correct use of the
with
statement and can explain the reasons for using it with certain sorts of objects and in certain sorts of situations, while also giving concrete examples of such use (such as for managing the lifecycle of interacting with a file). - Truth and Logic ~ candidates show an appreciation of idiomatic use of truth-iness (for instance, empty collections evaluate as
False
) and related operators within a wider coding context. - Logging ~ there is a familiarity with the basic use and configuration of the
logging
module or an alternative such asstructlog
. The candidate understands how to configure the formatting of log files and appreciates the different logging levels and their expected use. - Virtualenv and PIP ~ candidates are able to use and explain the purpose of a virtual environment. They can install and remove Python packages with the
pip
command. Furthermore, they understand the significance ofrequirements.txt
and how to use it to install all the packages needed for a working development environment. Finally, they are aware of and show some familiarity with the Python Packaging Authority (PyPA). - Code quality ~ there is a familiarity with various sorts of code quality related tooling. For instance, pycodestyle (for PEP8 style checking), pyflakes (for code analysis) and black (for code layout).
- Sphinx Documentation ~ the project's documentation is within a
doc
directory and under the control of Sphinx or a similar documentation tool. Candidates understand basicRST
orMarkdown
and the resulting documentation is well structured, clear, contains unambiguous examples and is comprehensive in scope. - Frameworks ~ if the project requires, candidates make effective use of a framework in their project's field. They show they have read and understood the framework's documentation and make use of it in a way that is idiomatic. If no framework is used in the candidate's project, they show some familiarity with the ecosystem of available frameworks in the wider Python world.
Grade 6 (Transitional)
Grade 6 is the first of the "enhanced" group of grades where the focus is upon refining, deepening and practising Python programming skills. The new concepts covered in this grade will be more abstract and several core concepts will be revisited but in more detail.
Core concepts
- Object Orientation Inheritance and Mixins ~ the candidate shows understanding of the notion and mechanics of inheritance in Python classes and is familiar with mixins as a form of multiple inheritance.
- Function Decorators ~ an appreciation of functions as first class objects (that can be passed into and out from other functions), and how this facilitates the notion of a decorated function in Python.
- Generator Functions ~ demonstrates a secure understanding of the
yield
keyword as a means of returning a result and pausing function execution. Candidates are able to explain the benefits of such lazy evaluation. - Frameworks ~ demonstrates knowledge of various popular frameworks and modules in the Python ecosystem used to address various problem domains. For example, Django, Flask, Jupyter, Numpy, Pandas, and Matplotlib are examples of such frameworks and modules popular in particular problem domains.
- Project Management ~ the project is managed in a coherent and responsible manner: code is available online (perhaps via a service like GitHub), is appropriately organised into modules, and development follows a coherent strategy (such as using feature branches, or PRs merged when complete). Bugs and issues are tracked and triaged and there may be evidence of code review and fixing merge conflicts if the project has collaborators.
- Community Development ~ the candidate ensures their project includes important community related assets, such as a Code of Conduct,
CONTRIBUTING
file, code style documentation, and other ways of setting expectations for collaboration. The content of these files is welcoming, friendly and empathetic. - Documentation ~ the project's documentation is well organised and clearly written for different types of reader. If required, it may include auto-generated API documentation, tutorials and/or examples.
Grade 7 (Advanced)
Grade 7 is the second of the "enhanced" grades and continues the focus on refining, deepening and practising Python. While there are fewer new concepts to cover in this grade, they are more abstract and require a depth of knowledge not encountered before.
Core concepts
- Concurrency ~ candidates understand the simple use of threading, multiprocessing and asyncio. They can explain basic/core concepts underlying such language features: for instance, blocking vs non-blocking code, event driven programming, the
async
andawait
keywords and coroutines. - Networking ~ they may make simple use of sockets for network programming. They describe the use cases for different networking protocols in the network stack (e.g. HTTP, TCP/IP, UDP, SMTP).
- User Interfaces ~ candidates demonstrate an understanding of at least one means of creating a user interface in Python: via a web page (including HTML forms), a GUI toolkit such as Qt, GTK or tkinter or a command-line framework such as Click. Evidence of basic user experience heuristics should be in evidence, as well as knowledge of accessibility related considerations.
- Mocking ~ the candidate shows knowledge and, if appropriate, use of appropriate use of mocking and patching in test suites. They explain some of the benefits and pitfalls of such an approach to demonstrate an appreciation of the subtleties involved in such testing technology.
- Test strategies ~ candidates clearly understand different types of test strategy (for example, the difference between unit and integration tests), and how such tests may be implemented or run with
tools such as PyTest, the built-in
unittest
module or Selenium. - Project Automation ~ common tasks associated with their project have been automated with, for
example, a Makefile or similar approach (
make test
,make docs
etc) and perhaps continuous integration services available online (GitHub actions, CircleCI etc). - Community Collaboration ~ candidates demonstrate an understanding of the collaborative and open behaviour expected for positive contributions to a FLOSS community. This includes a level of ethical conduct including, but not limited to, thanking people, taking part in respectful technical and community discussions, acknowledging and celebrating the work and achievements of others.
Grade 8 (Final)
Grade 8 is the final "enhanced" grade. Candidates will require an intuitive depth and breadth of knowledge not encountered in previous grades. They must demonstrate a coherent, compassionate and reflective attitude to their continued growth with Python.
Core concepts
- Magic Methods ~ the candidate understands what magic methods are, how they relate to Python protocols and can describe how these relate to the PEP process.
- Packaging ~ their project is appropriately packaged and may even appear on PyPI. They show an appreciation of the history of Python packaging and related ecosystem.
- Anonymous Functions ~ they know how to use the
lambda
keyword, can explain what an anonymous function is and appropriate use cases. - Online Documentation ~ comprehensive project documentation and related assets are published somewhere like ReadTheDocs or a project website.
- Continuous Integration and Automation ~ aspects of the project are automated using professional and freely available tools and services (for instance, running test suites, packaging or the publication of documentation is achieved through GitHub actions or webhooks used in concert with third-party services).
- Community Leadership and Mentoring ~ the candidate shows evidence of mature, measured, humane and pragmatic leadership in their dealings with the wider community of users and developers. They demonstrate the development of pedagogical skill as an effective and supportive mentor to other developers. For instance, they may have given lightning talks, full blown talks or helped mentor beginners online, in community events, and/or conferences.
- The Zen of Python ~ not only can the candidate quote the Zen of Python, but groks it.