Python IDLE:如何 运行 整个脚本,因为它总是在某个点停止

Python IDLE : how to run the whole script as it is always stopping at some point

我创建了一个列表,并为用户提供了选择他想要的任何方法的能力 运行。但是,当用户选择一个数字时,不会执行 if else 语句。有谁知道这是为什么?我是 IDLE 和 python.

的新手

这是我的代码

aList = ['hello','bonjour','hola','ohayo','hello'];
print("our list is: ", aList)

print("1-count, 2-inList, 3-Reverse, 4-find, 5-insert")
choice = input("please call the function you want to execute: ")

if choice == 1:
    word = input("which word would you like to count? ")
    print(aList.count(word))
elif choice == 2:
    inList = input("which word would you like to check if it's in the list")
    if inList in aList:
        print(True)
    else :
        print(False)
elif choice == 3:
    for i in reversed(aList):
        print(i)
elif choice == 4:
    item = input("what item would you like to find?")
    aList.index(item)
elif choice == 5:
    item = input("what would you like to anwser? ")
    aList.insert(item)

这是输出

our list is: ['hello', 'bonjour', 'hola', 'ohayo', 'hello'] 1-count, 2-inList, 3-Reverse, 4-find, 5-insert please call the function you want to execute: 1

>

我输入号码后总是停下来。我显然不理解python well

您需要转换为整数:

choice = int(input("please call the function you want to execute: "))