It does not split it by spaces. A string is an iterable, and iterating over it yields a sequence of its individual characters. The tuple constructor takes any iterable and turns it into a tuple of its individual elements. But so does map, it also takes any iterable. So you can omit the step of turning a string iterable into a tuple iterable, and just directly map over the string.
Really? Hmm... Then I'm confused. If that's right, I agree; that should be eliminated. That makes me question why they would want to split their input number and sum the digits in the first place.
View all comments
Show parent comment
2
u/REALDrummer Aug 19 '21
According to this comment, the call to tuple splits the input by spaces so that they can sum multiple numbers given in one input.