Rishi Vamatheva
Rishi Vamatheva

Reputation: 1

Why do I get TypeError: input expected at most 1 arguments, got 2 for this code (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

Upvotes: -1

Views: 1260

Answers (1)

Sede
Sede

Reputation: 61273

input() only takes one argument.

time_spent = int(input("Please select the minutes spent on",sports))
                                                            ^

To fix you can use this syntax

time_spent = int(input("Please select the minutes spent on {}".format(sports))

Upvotes: 1

Related Questions