HackerRank- Python Capitalize




You are asked to ensure that the first and last names of people begin with a capital letter in their passports. For example, alison heck should be capitalised correctly as Alison Heck.

Given a full name, your task is to capitalize the name appropriately.



  1. #!/bin/python3
  2. import math
  3. import os
  4. import random
  5. import re
  6. import sys
  7. # Complete the solve function below.
  8. def solve(s):
  9. a= s.title()
  10. return a
  11. if __name__ == '__main__':
  12. fptr = open(os.environ['OUTPUT_PATH'], 'w')
  13. s = input()
  14. result = solve(s)
  15. fptr.write(result + '\n')
  16. fptr.close()




codesadda.com

Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube