Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python 3.X Question 1 (10 points): Purpose: To build a program and test it. To get warmed up with Python, in case you are using

Python 3.X

image text in transcribed

Question 1 (10 points): Purpose: To build a program and test it. To get warmed up with Python, in case you are using it for the first time Degree of Difficulty: Moderate. Don't leave this to the last minute. The basic functionality is easy. There are aspects of the problem that you won't appreciate until you start testing A Latin Square is an arrangement of numbers 1 to N in a square, so that every row and column contain all the numbers from 1 to N. The order of the numbers in a row or column does not matter. Below are two squares, but only one of them is a Latin Square 1 2 4 3 2 3 1 4 3 4 2 1 4 1 3 2 12 43 2 3 14 3 4 2 1 4 1 3 3 The square on the left is a Latin Square for the numbers 1,2,3,4, whose rows consist of the numbers 1,2,3,4 (in any order) and whose columns consist of the numbers 1,2,3,4 (in any order). On the right, is a 4x4 square of numbers that is almost a Latin Square, but the bottom row is missing the value 2, and the column on the right is also missing the value 2. There are Latin squares of all sizes Definition: A N x N Latin square is formally defined by the following criteria: . Every row contains the numbers 1 through N exactly once, in any order. . Every column contains the numbers 1 through N exactly once, in any order. When the Latin square is N x N we say that it has "order N". The order tells us which numbers to look for, and how big the square is In this question you will implement a program that checks whether a N x N square of numbers is a Latin Square or not. Your program should work by reading input from the console, and sending an answer to the console, as in the following example . Your program should check latin squares of size 4 (N-4) . It reads 4 lines of 4 of numbers, i.e., it reads console input for a square of numbers. . It checks whether the sequence of numbers is a Latin square or not. Your program should display the message 'yes" if it satisfies the above criteria, or "no" if it does not

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases With Application To GIS

Authors: Philippe Rigaux, Michel Scholl, Agnès Voisard

1st Edition

1558605886, 978-1558605886

More Books

Students also viewed these Databases questions

Question

Prepare a short profile of Lucy Clifford ?

Answered: 1 week ago

Question

Prepare a short profile of Rosa parks?

Answered: 1 week ago

Question

Prepare a short profile of victor marie hugo ?

Answered: 1 week ago

Question

b. Will new members be welcomed?

Answered: 1 week ago