Python 如何让函数接受两个参数?

Python 如何让函数接受两个参数?,python,list,function,arguments,main,Python,List,Function,Arguments,Main,python新手。所以我有这个函数,我不知道如何让它接受两个参数,并在另一个列表中返回它们的位置。 在主程序中,我希望它调用x在列表中搜索,并在出现的地方打印消息。 我这样做对吗? 这就是我想到的。 非常感谢你的帮助 提前谢谢 def find_multiple(): arg1 = input(" L: " ) arg2 = input(" x: ") return L def main(): L = [4, 10, 4, 2, 9, 5, 4 ] x

python新手。所以我有这个函数,我不知道如何让它接受两个参数,并在另一个列表中返回它们的位置。 在主程序中,我希望它调用x在列表中搜索,并在出现的地方打印消息。 我这样做对吗? 这就是我想到的。 非常感谢你的帮助 提前谢谢

def find_multiple():
    arg1 = input(" L: " )
    arg2 = input(" x: ")

    return L

def main():
    L = [4, 10, 4, 2, 9, 5, 4 ]
    x = int(input("Enter an element to search for in the list: "))
    if (len(L_indexes) == 0):
        print(x, " does not occur in L.")
        L =[]
        results = L    

print("enter an element to search for in the list: " )
if(len(L) == 0):
    print("element does not occur in the list")
else:
    print("the number of occurrences in L: ", x)

main()
编辑:根据您发布的内容,我认为您正在尝试这样做。

def search(myBigFancyX, myBigFancyList):

    counter = 0
    for number in myBigFancyList:
        if number == myBigFancyX:
            counter += 1
    return counter

if __name__ == "__main__":

    l = [4, 10, 4, 2, 9, 5, 4 ]
    x = int(input("Enter an element to search for in the list: "))

    occurances = search(x, l)
    if occurances == 0:
        print("element does not occur in the list")
    else:
        print("the number of occurrences in L: ", occurances)

你知道如何让一个函数接受一个参数吗?阅读教程可能是个好主意。。。啊,是的,谢谢你。我不确定争论的方向。起初我的想法和你在这里发布的一样,但后来我有所怀疑。谢谢,这是一个很大的帮助。
search
似乎要编写
myBigFancyList.count(myBigFancyX)
。@JonClements是的,但我敢打赌他的老师希望他使用原语,什么都不用。
def search(myBigFancyX, myBigFancyList):

    counter = 0
    for number in myBigFancyList:
        if number == myBigFancyX:
            counter += 1
    return counter

if __name__ == "__main__":

    l = [4, 10, 4, 2, 9, 5, 4 ]
    x = int(input("Enter an element to search for in the list: "))

    occurances = search(x, l)
    if occurances == 0:
        print("element does not occur in the list")
    else:
        print("the number of occurrences in L: ", occurances)