Set .discard(), .remove() & .pop()

  • + 0 comments

    In the parentheses.

    First we split the input, putting the first value into into method - which contains the name of the method - and the rest of the values (the arguments) into args.

    methods[method]
    

    consults the dictionary and returns the method we want. By putting () after the method, we pass arguments to it. Inside the parentheses, we have

    *map(int, args)
    

    The map function converts all the values in args from strings into numbers. Because this is inside the parentheses, putting an asterisk at the beginning takes all the values out of the sequence returned by map and gives them to the method as arguments.