Created
          November 19, 2019 17:37 
        
      - 
      
 - 
        
Save Yepoleb/b27c3715e1f2b48b8d52a9a3ab853fd0 to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | summands = [1] | |
| for i in range(9): | |
| summands.append(summands[-1] * 10) | |
| def rowsum(row): | |
| return sum(summands[x] for x in row) | |
| valid_sum = rowsum([1, 2, 3, 4, 5, 6, 7, 8, 9]) | |
| def is_sudokurow(row): | |
| return rowsum(row) == valid_sum | |
| print(summands) | |
| print(is_sudokurow([1, 2, 3, 4, 5, 6, 7, 8, 9])) | |
| print(is_sudokurow([8, 2, 5, 4, 3, 6, 7, 1, 9])) | |
| print(is_sudokurow([1, 2, 3, 4, 5, 6, 7, 7, 7])) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment