[Solved]Python Code Task 4 Must Write Function Printlistintableformat Takes Input List Representin Q37045476
Python code:
Task 4
You must write a function printListInTableFormat thattakes as input a list representing a candidate solution for theN-Queens problem and prints the solution in a matrixformat.


For example: your program could do the following: Enter N: 4 Enter position of Queen: 10 Enter position of Queen: 3 1 Enter position of Queen 0 2 Enter position of Queen 23 0 0 1 0 1 0 0 0 0 0 0 1 0 1 0 0 Task 5: Modify your program in Task 4, so that it prints a message telling the user if their candidate solution is a correct solution to the N-Queens problem. You should write a function checkSolution that takes the list representing the candidate solution and returns True if the candidate solution is a correct solution and False otherwise. You may like to write additional functions that can be used by the function checkSolution For example: your program could do the following Enter N: 4 Enter position of Queen: 1 0 Enter position of Queen: 3 1 Enter position of Queen: 02 Enter position of Queen: 23 0 0 1 0 1 0 0 0 0 0 0 1 0 1 0 0 This is a real solution to the problem. and another example Enter N: 3 Enter position of Queen: 0 1 Enter position of Queen: 1 2 Enter position of Queen: 2 0 0 1 0 0 0 1 1 0 0 This is not a real solution to the problem. Which representation was easier to print as a matrix? Which representation would make it easier to check if the candidate solution was a correct solution to the problem? Show transcribed image text For example: your program could do the following: Enter N: 4 Enter position of Queen: 10 Enter position of Queen: 3 1 Enter position of Queen 0 2 Enter position of Queen 23 0 0 1 0 1 0 0 0 0 0 0 1 0 1 0 0
Task 5: Modify your program in Task 4, so that it prints a message telling the user if their candidate solution is a correct solution to the N-Queens problem. You should write a function checkSolution that takes the list representing the candidate solution and returns True if the candidate solution is a correct solution and False otherwise. You may like to write additional functions that can be used by the function checkSolution For example: your program could do the following Enter N: 4 Enter position of Queen: 1 0 Enter position of Queen: 3 1 Enter position of Queen: 02 Enter position of Queen: 23 0 0 1 0 1 0 0 0 0 0 0 1 0 1 0 0 This is a real solution to the problem. and another example Enter N: 3 Enter position of Queen: 0 1 Enter position of Queen: 1 2 Enter position of Queen: 2 0 0 1 0 0 0 1 1 0 0 This is not a real solution to the problem. Which representation was easier to print as a matrix? Which representation would make it easier to check if the candidate solution was a correct solution to the problem?
Expert Answer
Answer to Python code: Task 4 You must write a function printListInTableFormat that takes as input a list representing a candidate… . . .
OR

