首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Python数独拼图9 x 9棋盘

Python数独拼图9 x 9棋盘
EN

Stack Overflow用户
提问于 2014-03-13 02:43:13
回答 1查看 116关注 0票数 0
代码语言:javascript
运行
复制
while True:
    try:
        file = input("Enter a filename: ") 
        fi = open(file, "r")
        infile = fi.read()
        grid = [list (i) for i in infile.split()] #Puts the sudoku puzzle into a list in     order to check that the total number is valid
        check = len(grid)
        print("The total number in this puzzle is:",check) #Counts the amount of numbers in the sudoku puzzle
        break
    except FileNotFoundError:
        print ("The inputted file does not exist")

def check(infile):
    count = 0
    for j in range (0,9):
        for n in range(0,9):
            if infile[j].count(infile[j][n]) <= 1:
                count = count + 0
            else:
                count = count + 1

这是我当前数独检查程序的代码,有人能告诉我它出了什么问题吗?因为我正在尝试找出列中的所有数字是否都在1和9之间

EN

回答 1

Stack Overflow用户

发布于 2014-03-13 02:45:22

在此代码中,您从未显式调用函数check

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22360985

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档