Output For the candidate sudoku in the file, your program should simply print: True if the sudoku is valid (i. each digit is used once in each 3x3...
This question has been answered
Question

Writing a program using basic python tools. Explanation or docstring would really be appreciated, This is for a first year computer science course so keep it simple please. Thank you !


question 1 part 1.png

quest 1 part 2.png

Image transcriptions

A sudoku is a popular puzzle that involves using the digits from 1 to 9 in various ways. For this assignment. we will consider only what we call a simplified sudoku. A simplified sudoku consists of an N x N grid, where N is always a multiple of 3. Each 3x3 block of the grid forms its own area. For example, on a 9x9 grid, there will be 9 such areas: AP 7 8 1 8 7 2 1 3 W U W N 7 8 8 1 3 un W A W N CO U 9 A simplified sudoku is valid if and only if each area contains all of the digits from 1 to 9 exactly once (real sudokus have constraints on the rows and columns as well, but we'll ignore those here). The example above is a valid simplified sudoku. In this question you will implement a program that checks whether an N x N square of numbers is a valid simplified sudoku or not. Input The data for your program will come from a datafile that describes a single sudoku puzzle that may or may not be valid. You can 'hardcode' the name of the data file in your program. To test on different data files. just change the file name in your program. The file will consist of the following lines: . A number N on a line by itself. This will be the size of the sudoku. You may assume that N is greater than O and is always a multiple of 3. . N lines of N of integers, separated by spaces A sample input file might look like this: W N W 1 W N You will be provided with several input files on the class Moodle. You can test your program with these. We will also test your program with some input files that we are NOT giving you.

Output For the candidate sudoku in the file, your program should simply print: . True if the sudoku is valid (i.e. each digit is used once in each 3x3 area) . False otherwise What to Hand In . Your implementation of the program: alq1 . py. Be sure to include your name. NSID, student number, course number and laboratory section at the top of all documents. Evaluation . 4 marks: Your program reads the datafiles correctly . 8 marks: Your validity check is well implemented and can handle sudokus of varying size . 4 marks: Your program produces the correct output for each test file . 4 marks: Documentation. You have made an appropriate effort to document your code.

Answered by Expert Tutors

inia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam ris

et, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio.
Step-by-step explanation

trices ac magn

, dictum vitae

ng elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur lao

, dictum vitae

, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit

ur laoreet. Nam risus ante, dapibus a molestie consequat, u

o. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipi

acinia pulvinar tortor nec facilisis. Pellentesque da

sum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitu

entesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, d

ur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. F

ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliqu

ec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie c


ce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet

ur laoreet. Nam risus ante, dapibus a molestie

rem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellen

cing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus an

ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesqu


nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrice

, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvin

usce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consect

ur laoreet. Nam risus ante, dapibus a molestie

fficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue

a. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing el

nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui le

ce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam

ng elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque

usce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dol

s ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet

acinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a m

ur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectu

acinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a m

molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae

acinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a m


sque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna.

facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce

gue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing eli

dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia

ec aliquet. Lorem ipsum dolor sit amet, con

The student who asked this found it Helpful
Overall rating 100%
Get unstuck

487,593 students got unstuck by Course
Hero in the last week

step by step solutions

Our Expert Tutors provide step by step solutions to help you excel in your courses