HackerRank Python

Capitalize!

  • 0 < len(S) < 1000
  • The string consists of alphanumeric characters and spaces.
chris alan
Chris Alan
# Complete the solve function below.def solve(s):return ' '.join(word.capitalize() for word in s.split(' '))
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')s = input()result = solve(s)fptr.write(result + '\n')fptr.close()

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store