为什么我会收到TypeError:此代码(Python)需要的最多为1个参数,但收到了2个。

2024-09-27 00:12:13 发布

您现在位置:Python中文网/ 问答频道 /正文

client_dict = {"NeQua":"High","EmVol":"Moderate","RiVam":"High","EdLis":"Moderate"}
Intensity_sports = {"High":["swimming","aerobics"],"Moderate":["Basketball","Hiking"]}
def main():
    def clientID_choice():
        global clientid,intensity
        clientid = input("What client would you like to edit?:")
        while clientid not in client_dict:
            clientid = input("\nPlease enter the correct client\nWhat client would you like to edit?:")
        intensity = client_dict[clientid]
        print("\n"+clientid,"has a",intensity,"intensity\nThe reccomened sports are:")
        for sports in Intensity_sports[intensity]:
            print("//",sports)
    clientID_choice()

    def resultInput():
        time = []
        for sports in Intensity_sports[intensity]:
            time_spent = int(input("Please select the minutes spent on",sports))
            while not 0 <= time_spent <= 120:
                time_spent = int(input("Please select the minutes spent on",sports," between 0 and 120"))
            time.append(time_spent)
        total_time = 0
        for time_spent in time:
            total_time += time_spent
        print("\n"+clientid+"'s total time spent is",total_time,"minutes")
    resultInput()

    def again():
        anotherRecord = input("Do you wis to enter another record? Type yes or y or no or n")
        while anotherRecord.lower() != "yes" and anotherRecord.lower() != "y" and anotherRecord.lower() != "no" and anotherRecord.lower() != "n":
            anotherRecord = input("Please answer again. Yes or No?")
        if anotherRecord.lower() == "yes" or anotherRecord.lower() == "y":
            print("You will now enter a new client record")
            main()
        else:
            print("Thank you")
    again()
main()

time_spent = int(input("Please select the minutes spent on",sports))
TypeError: input expected at most 1 arguments, got 2

Tags: ortheinclientyouinputtimedef

热门问题