Python Algorithms for A/S Computer Science

This is a collection of Python implementations of algorithms discussed in the Cambridge A and A/S Level Computer Science text book.

They are also suitable for other exam boards and study at GCSE for more able students.

Programs included:

  • Using nested loops to print a rectangular pattern
  • Printing a pyramid pattern - not using functions
  • Printing a pyramid pattern - using functions
  • Printing a hollow pyramid pattern - not using functions
  • Printing a pyramid pattern - using functions

These algorithms are fun and satisfying for students due the the pleasing visual output. It is a good idea to give students the chance to implement them for themselves before providing solutions.

The Python code given in the teacher’s resource for this course is un-pythonic and often contains errors. The implementations provided here are written in a more pythonic style, are free from errors and provide an intuitive mapping to the pseudo-code given for the algorithms.

Please note that I have translated the CIE pseudo-code construct of REPEAT…UNTIL using

while True:
# commands
if condition:
break

which I consider the best conceptual equivalent.

I hope you find this resource helpful.

$19.75
Save for later
  • hollow_pyramid_functions.txt
  • hollow_pyramid_no_functions.txt
  • pyramid_functions.txt
  • pyramid_no_functions.txt
  • rectangle_pattern.txt

About this resource

Info

Created: Dec 12, 2019

txt, 2 KB

hollow_pyramid_functions

txt, 1 KB

hollow_pyramid_no_functions

txt, 1 KB

pyramid_functions

Report a problem

Tes Paid Licence

How can I re-use this?