Python Resource Pack 8
Python Resource Pack 8 is a set of coding challenges designed to support the teaching and learning of the Python programming language.
This pack is designed for those who have some experience of programming in Python, such as completing the exercises in Resource Packs 1 - 7. It is suitable for teaching Python in schools at AS and A Level, for tutors and learners in adult learning classes or for the hobbyist learning at home.
As part of the higher-level learning and exam preparation for which the pack is designed, these challenges necessitate a greater degree of design and coding ability than the challenges in Resource Packs 6 and 7. Emphasis is placed on the system life cycle and program documentation by requiring:
- Full design prior to coding (system flowchart, program flowchart, pseudocode, data dictionary).
- Full validation so only valid data can be entered by the user.
- Meaningful names for variables, procedures and functions.
- Full error trapping.
- Fully commented code.
- Complete evidence of the program being tested during development (Alpha Testing or White Box Testing).
- Complete evidence of the program being tested post development (Beta Testing or Black Box Testing).
The pack is designed to support learning that has previously taken place in the classroom, via self-directed study, or by following tutorials.
The pack contains five challenges, each consisting of:
- A pdf file with one or more coding challenges and, in some cases, supplementary extension work.
- Fully commented example solutions to the challenge or challenges and any extensions.
The following topics are introduced:
- The
datetime
module, and specifically date()
and datetime()
within it. - The
dateutil
add-on module, and specifically relativedelta()
within it.
The challenges are designed so that self-directed research will be required to complete them; they are not a cut-and-paste tutorial.
The challenges:
- Write a Game of Chance according to the given rules and using a supplied constants file. Includes extension work.
- Write a simulation of a Fruit Machine using a supplied constants file. Includes extension work.
- Enter two positive integers, show their Product of Prime Factors, the Highest Common Factor (if there is one) and the Lowest Common Multiple.
- Enter a string representing a UK driving licence number and the holder's personal details. If the driving licence number is in the correct format, use the given personal details to determine if the driving licence is valid or not.
- A series of tasks involving the management of a County Council's Average Speed Camera zones and traffic violations committed in them.