![]() And also pass what you want to default to. ![]() To make the code more reliable you can pass the amount of rows and columns.Your name listOfLists isn't PEP 8 compliant.You can also merge listOfLists into this loop too. You can just check if the row index is 3 or 6. You don't need to use modulo arithmetic to display the line.Rather than using modulo arithmetic for each row, you can just make a new list using slices.Use enumerate, rather than range and indexes.You're just limiting the functionality and reusability of your code without really any benefit. """Create a Sudoku board from user input.""" Print("Please enter an integer between 1 and 9" # Takes an input makes sure it is good, and if not ask for another one, if it is add it to the listį"Please enter an integer for the square in column (hit enter for no number): " """Creates the sudoku board from user input"""īoard = for _ in range(ROWS)] # Creates the nested list to contain the board GRID_ROWS = GRID_COLS = 3 # The rows and columns in which there are lines ROWS = COLS = possibleValues = 9 # The rows and columns of the board import time # Used to add a delay for user readability For my programming class I had to make a sudoku solver.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |