小编Dah*_*aka的帖子

TypeError:list indices必须是整数,而不是float

我有一个python 3.x程序产生错误:

def main():
    names = ['Ava Fischer', 'Bob White', 'Chris Rich', 'Danielle Porter',
             'Gordon Pike', 'Hannah Beauregard', 'Matt Hoyle',
             'Ross Harrison', 'Sasha Ricci', 'Xavier Adams']

    entered = input('Enter the name of whom you would you like to search for:')
    binary_search(names, entered)

    if position == -1:
        print("Sorry the name entered is not part of the list.")
    else:
        print(entered, " is part of the list and is number ", position, " on the list.")
    input('Press<enter>')

def binary_search(names, entered):
    first = 0 …
Run Code Online (Sandbox Code Playgroud)

list binary-search typeerror python-3.x

21
推荐指数
1
解决办法
5万
查看次数

标签 统计

binary-search ×1

list ×1

python-3.x ×1

typeerror ×1