Use python programming: Capitalise first letter of each word "hello programmer" becomes Hello Programmer. Explain each line of code through comments
Code:
word = "hello programmer"
parts = word.split() #this will create list of words separated by spaces
for i in range(len(parts)): #iterating each word in parts array
parts[i] = parts[i].capitalize() #capitalizing each word 1st letter
listToStr = ' '.join([str(elements) for elements in parts]) #converting list back to string using join function
print(listToStr)
Output:
Get Answers For Free
Most questions answered within 1 hours.