Round 2: capitalize 1st and last character of each word in a given string. Eg: 'hello there' should return 'HellO TherE'
AnswerBot
1y
The task is to capitalize the first and last character of each word in a given string.
Split the string into an array of words
Iterate through each word and capitalize the first and last character
Join t...read more
Naman Sachdeva
1y
a = input()
b = a.split()
for i in b:
print(i[0].upper()+i[1:len(i)-1]+i[-1].upper(),end=" ")
Varun Sudrik
2y
a = input()
print(a[0].upper()+a[1:len(a)-1]+a[-1].upper())
Add answer anonymously...
Top NEC Graduate Engineer Trainee (Get) interview questions & answers
Popular interview questions of Graduate Engineer Trainee (Get)
Top HR questions asked in NEC Graduate Engineer Trainee (Get)
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app