Answered step by step
Verified Expert Solution
Question
1 Approved Answer
using python 3.0 or + I need help finishing writing the code for determining a latin square. A Latin square is a square of N
using python 3.0 or +
I need help finishing writing the code for determining a latin square. A Latin square is a square of N by N, where all the rows, columns have one value of 1 to N exactly.
Here is what I got so far.
## The following code assigns the values of the latin square values from the user input. latin_sq_order= int(input("Please enter the value of the Latin Square order (N): ")) latin_sqaure_list = [ (x).split(',') for x in input("enter the latin square with spaces in between the numbers: ").split()] def is_latin_sq(list,order): count_1 = 0 count_2 = 0 count_3 = 0 for x in list: for y in x: if int(y) == 1: count_1 += 1 elif int(y) == 2: count_2 += 1 elif int(y) == 3: count_3 += 1 if count_1 and count_2 and count_3 == count_2: print("Is a latin square.",) else: print("Is not a latin square", )
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started