pythonshell不返回任何内容

pythonshell不返回任何内容,python,Python,这是我下面的代码,我相信应该是有效的。当我调用它时,pythonshell返回空(空白),并且上面只弹出另一个重启行。想知道如何解决这个问题吗 有关此功能问题的说明如下: 描述:编写一个名为animal_locator的函数,该函数接受字典 包含动物园位置作为键,其值是具有 特定动物和该动物园特定动物的种群。你应该 返回一个字典,其中包含作为键的动物及其元组值 它们的第一个元素是基于 每个位置(从大到小)和第二个元素有多少动物 是该特定动物总种群的整数。 您不必考虑区分大小写 def anima

这是我下面的代码,我相信应该是有效的。当我调用它时,pythonshell返回空(空白),并且上面只弹出另一个重启行。想知道如何解决这个问题吗

有关此功能问题的说明如下: 描述:编写一个名为animal_locator的函数,该函数接受字典 包含动物园位置作为键,其值是具有 特定动物和该动物园特定动物的种群。你应该 返回一个字典,其中包含作为键的动物及其元组值 它们的第一个元素是基于 每个位置(从大到小)和第二个元素有多少动物 是该特定动物总种群的整数。 您不必考虑区分大小写

def animal_locator(places):
newdict = {}
for city in places:
    numtup = len(places[city])
    num = 0
    while num < numtup:
        if places[city][num][0] not in newdict:
            newlist = []
            newtup = (places[city][num][1], city)
            newlist.append(newtup)
            for city1 in places:
                if city1 != city:
                    for tup in places[city1]:
                        if tup[0] == places[city][num][0]:
                            tupnew = (tup[1], city1)
                            newlist.append(tupnew)
            newlist.sort(reverse=True)
            count = 0
            newlist2 = []
            for tup in newlist:
                newlist2.append(tup[1])
                count += tup[0]
                newtup = (newlist2, count)
            newdict[places[city][num][0]] = newtup
    num += 1
return newdict

zoo_location1 = {'San Diego': [('lion', 4), ('tiger', 2), ('bear', 8)], 'Bronx': [('lion', 20), ('snake', 5), ('tiger', 1)], 'Atlanta': [('lion', 3), ('snake', 2), ('bee', 4500)], 'Orlando': [('bee', 234), ('tiger', 123)]}
animal_dict1 = animal_locator(zoo_location1)
print(animal_dict1)
def动物定位器(位置):
newdict={}
对于城市中的某些地方:
numtup=len(地点[城市])
num=0
当num
我发现我的num+=1行需要用一个制表符缩进,然后它就正常运行了。

你能把你实际调用函数的代码显示出来吗?