Suppose we have a sentence with English lowercase letters. We have to convert first letter of each word into uppercase.
So, if the input is like s = "i love my country", then the output will be "I Love My Country"
To solve this, we will follow these steps −
Let us see the following implementation to get better understanding
def solve(s): words = s.split(' ') ret =  for i in words: ret.append(i.capitalize()) return ' '.join(ret) s = "i love my country" print(solve(s))
"i love my country"
I Love My Country