TypeError:transferMoney()缺少1个必需的位置参数:'amount'

时间:2018-01-13 18:37:54

标签: python

你好我看过这样的其他帖子但是找不到修复...... 我只包括出现问题的代码,有更多的代码,但其余的都是不敬的。

 def transferMoney(self, sender_account, receiver_name, receiver_account_no, amount):
    self.sender_account = found_customer
    self.reciver_name = customer_name = input("\nPlease input customer name \n")
    customer = self.search_customers_by_name(customer_name)




 def run_admin_options(self, admin):

    loop = 1
    while loop == 1:
        choice = self.admin_menu(admin.get_name())
        if choice == 1:
            customer_name= input("Please Enter The Name Of The Customer Sending Money: ")
            sender_account_no= int(input("Please Enter the Account Number Of The Person Sending Money: "))
            recipient_name= input("Please Enter the name of the person reciving money: ")
            recipient_account_no= int(input("Please Enter the recipient account number: "))

            found_recipient= self.search_customers_by_name(recipient_name)
            found_customer= self.search_customers_by_name(customer_name)
            if found_recipient ==None:
                return ("Customer Not Found")
            else:
                if found_customer != None:
                    my_account= found_customer.get_account()
                    receiver_account= found_recipient.get_account()
                    amount_transfer= float(input("Please Enter Amount You Would Like To Send: "))
                    transferMoney= self.transferMoney(my_account, receiver_account, amount_transfer)

2 个答案:

答案 0 :(得分:0)

请为您的函数提供receiver_name参数值。

答案 1 :(得分:0)

在您提供的最后一行代码中,您没有传入receiver_account_no。截至目前,您的程序认为receiver_account_no实际上是要传输的金额。这样就不会传入预期的数量参数。