my code failed 4/6 test cases for the below problem,
Here is my code:
def solve(s): s = s.split() return ' '.join([i.capitalize() for i in s])
correct solution should be:
return ' '.join(map(str.capitalize, string.split(' ')))
As a python newbie, I understand what map function does in the correct solution but I can’t see why my code failed few cases. Anyone can give me a hand, please?
Source: Python Questions