We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Set .discard(), .remove() & .pop()
You are viewing a single comment's thread. Return to all 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.
consults the dictionary and returns the method we want. By putting () after the method, we pass arguments to it. Inside the parentheses, we have
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.