rage / programming-24

63 stars 39 forks source link

Problem with the TMC grader #10

Open JohnYak1949 opened 9 months ago

JohnYak1949 commented 9 months ago

Many of the exercises in part05 Python-programming-2024 run successful in Visual Studio Code but fail when tested by the TMC grader. The error messages received when I submit the code make no sense to me. The culprits all seem to involve sudoku exercises: part05-04, -05, -06, -07, and -10. Strangely 05-11 worked OK. Here is my code for part5-04:

Write your solution here

def row_correct(sudoku: list, row_no: int): for i in range(len(sudoku[row_no])): num = sudoku[row_no][i] if num == 0: continue if sudoku[row_no].count(num) > 1: return False else: return True

if name == "main": sudoku = [ [9, 0, 0, 0, 8, 0, 3, 0, 0], [2, 0, 0, 2, 5, 0, 7, 0, 0], [0, 2, 0, 3, 0, 0, 0, 0, 4], [2, 9, 4, 0, 0, 0, 0, 0, 0], [0, 0, 0, 7, 3, 0, 5, 6, 0], [7, 0, 5, 0, 6, 0, 4, 0, 0], [0, 0, 7, 8, 0, 3, 9, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 3], [3, 0, 0, 0, 0, 3, 0, 0, 2]]

print(row_correct(sudoku, 0)) print(row_correct(sudoku, 1))