Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HELP Python 3 Functions Coding: Below are the functions required to fully complete the functions def get_valid_numbers(size): validList = [] for i in range(1, size

HELP Python 3 Functions Coding: Below are the functions required to fully complete the functions

def get_valid_numbers(size): validList = [] for i in range(1, size + 1): validList.append(i) return validList

def get_row(puzzle, row_index): size = get_size(puzzle) if row_index + 1 > size: return None return puzzle[row_index]

def has_repeat(xs, v): count = 0 for i in xs: if i == v: count += 1 if count > 1: return True else: return False

image text in transcribed

complete): given a puzzle, determine if the row at row index is a is valid row (puzzle row index valid set of numbers (containing only valid values and unique values) complete is a boolean indicating if the row may contain None values. As before, ifthe puzzle is incomplete, also allow None, if it is complete, do not allow None. Also note that it is OK to have multiple None values in one row. (HINT use get valid numbers get row() and has repeat 2,4, None, None ],[1, 2, 3,3],[ board ,3,None, None is valid row (board, 0, False) True ok to have None if incomplete is valid row (board, 0, True) False cannot have None if complete is valid row(board, 1, True False two 3s in same row is valid row (board, 2 False) False invalid value 5 is valid row(board 2, True) False not even a valid row complete) determine if all the rows in puzzle are valid complete is a boolean has valid rows (puzzle ndicating if the rows should not contain None values. If incomplete allow None, if complete, do not allow None. (HINT and is valid row as part of your solution) use get row has valid rows ([[1,2],[1,21 True True has valid rows (CC1,None],[1,21] False) True has valid rows ([[1,None],[1, 211, True) False cannot have None if complete has valid rows ([[1,4],[1,21], True False row 0 has a 4 in a 2x2 puzzle col index): return the column with specified col index from puzzle as a list get column (puzzle Return None if col index is invalid get column ([[1, None],[2, Nonell, 0) [1 21 col 0 get column [1,None],[2,None]], 1) [None, None] col 1 get column([ [1,None],[2,None]], 2) None invalid index complete): similar to is valid row but checking the validity of is valid col (puzzle col index specified column instead. (HINT: use get valid numbers get column() and has repea board [[2,1,None,None],[None, 2,3,3],[3, 1,None,5],[4,3,None,None]] is valid col(board, 0, False) True ok to have None if incomplete is valid col(board, 0, True) False cannot have None if complete is valid col(board 1, True) False two 1s in same column is valid col(board, 3, False) False invalid value 5 is valid col(board 7, False not even a valid column True complete): determine if all the columns in puzzle are valid. complete is a has valid cols (puzzle boolean indicating if the columns may contain None values. If incomplete allow None, if complete, do not allow None. (HINT: use is valid col() and get column() as part of your solution) has valid cols (CC1,2],[1,11], True False two in col 0 has valid cols([[1,None],[2,11] False) True has valid cols ([[1,None ],[2,111, True False cannot have None if complete has valid cols ([[1,4], [2,111, True False col 1 has a 4 in a 2x2 puzzle

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

Semantics In Databases Second International Workshop Dagstuhl Castle Germany January 2001 Revised Papers Lncs 2582

Authors: Leopoldo Bertossi ,Gyula O.H. Katona ,Klaus-Dieter Schewe ,Bernhard Thalheim

2003rd Edition

3540009574, 978-3540009573

More Books

Students also viewed these Databases questions

Question

Prepare an ID card of the continent Antarctica?

Answered: 1 week ago