Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help with solving / explaing these codes! Python 3: the codes needed to complete this are: def get_column(puzzle,col_index): size = get_size(puzzle) if col_index +
Please help with solving / explaing these codes! Python 3: the codes needed to complete this are:
def get_column(puzzle,col_index): size = get_size(puzzle) if col_index + 1 > size: return None lst = [] for i in range(size): lst.append(puzzle[i][col_index]) return lst
def get_valid_numbers(size): validList = [] for i in range(1, size + 1): validList.append(i) return validList
def is_valid_location(loc, puzzle): num = len(puzzle) (row, col) = loc if (row
def get_missing_numbers_row_or_col()
get missing numbers row or col(xs): determine which values are missing from the specified row (or column). The numbers should be returned in order. Note that if a column is passed in, it will be as a list (as is the return from get column(). (HINT: use get valid numbers to as part of your solution.) o get missing numbers row or col (C1.2]) no values missing o get missing numbers row or col(C1,None, 21) 131 value mising o get missing numbers-row or col [1,2,31 all missing o get missing numbers row or col([None,None,1]) [2,3] 1 is in place o get missing numbers row or col (C1.1 11) [2,3] 1 is in place candidates at location (puzzle, loc): return a list of suggested values for the given location (row, column) based on missing value checking of row and col. If the location is invalid or already contains a value, return None. (HINT: use is valid location and get missing numbers row or col o candidates at location ([[None (0,0)) [1] o candidates at location (CE1]], (0,0)) None location already contains a value o candidates at location ([[None (1,1)) None location is invalid o candidates at location (CC1,2,31,[2,3,1],[3,None, Nonel 1, (2,1)) [1,21 valid for row, only [1] valid for column o candidates at location (CC1,2,31,[1,3,2],[1,None, Nonel 1, (2,1)) [2,31 valid for row [1] valid for column is symmetric (puzzle) check whether the given puzzle is symmetric with respect to the main diagonal; return True if it is symmetric and False otherwise. See examples below. Restriction: must not modify the original puzzle! board 1 [[3,1,2],[1,3,1],[2, 1,311 board 2 [[3,1,2],[2,3,1] 1,2,3]] o is symmetric (board 1) True o is symmetric (board 2) False 1 2 board 1: symmetric board 2: not symmetric
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