Assignment Task:

You are required to solve and write Python code for the task below; and also produce a written report to describe and analyse the problem you are solving, explain your solution to the problem, and detail how you have tested and evaluated your solution.

You must use Python version 3 for this assignment; submissions using any other programming language or Python version will not be marked and could result in a mark of zero for this assignment.

Latin Square Puzzle:

Write a Python program to validate a given Latin Square puzzle board.


  • Simply: A normal Latin Square is an n x n square grid filled with n different characters so that each character occurs only once in each row and in each column. The grid can vary in size, but must be a square formation (3x3, 4x4, 5x5, etc.).
  • If you are unsure of the rules of a Latin Square puzzle then look them up.

Examples of some valid Latin Square puzzle boards: see image.

The Latin Square puzzle boards will be supplied in the form of a text file, for example: see image.

The program should prompt the user for the filename of a text file to open some Python error handling should be used in case the user enters the name of a file that does not exist.

The program should read the contents of the given text file and store this in a suitable Python data structure.

Appropriate validation should be in place to ensure the supplied file contains a complete n x n square grid of characters, and where there are exactly n different characters used in the grid.

Assuming an n x n square grid of n different characters is successfully loaded into the chosen data structure, further checks should then be performed to ensure that no character appears more than once in each row, and in each column of the grid.

If any errors are detected in the Latin Square puzzle board then details of these errors should be given to the user.

If the Latin Square puzzle board passes all the validation checks, then it should be written into a new text file using the same format as the original input file (see the example text files above) the name for this new text file should be the original filename entered by the user prefixed with CHECKED_.

To make your code more efficient and neat you should write your segments of your code in functions where appropriate for particular tasks.


Produce a written report in a Microsoft Word document (or similar) to describe your program.

The report must contain the following sections:

  • Introduction this should contain some background information and generally summarise the problem being solved in this task.
  • Solution Explanation this is the main body of your report where you should describe your design and solution to the problem/task outlined in the introduction, and explain any key aspects to the program. You can also use this section to explain your design rationale for certain parts of your code (i.e. why have you done something in a certain way).
  • Testing explain how you have tested your program, and if appropriate give some sample data and output examples from the program
  • Conclusion use this section to evaluate your work (i.e. your solution to the problem described in the introduction), for example, what has worked well, what would you like to change next time.
  • Appendix you should copy and paste your entire program code into this final section of the report.

Please note, any code pasted into the report should use the Courier New (or a similar fixedwidth) font to distinguish it from any other text; screenshots must not be used for source code.

Maximum length for the report: ~1800 words (excluding contents page, code segments, bibliography, and appendix).

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.