+ 2

How we change the first letter of first name and first letter of last name in capital letter if input would be all in lower case

Example :raj mohan then output should be Raj Mohan,by inbuilt function

15th Dec 2019, 7:57 PM
Subhash Kumar
Subhash Kumar - avatar
15 ответов
+ 2
Subhash Kumar This works fine. But I think, the function needs a name. instead of def(s): Something like this def cap(s): for examle
15th Dec 2019, 8:57 PM
Coding Cat
Coding Cat - avatar
+ 3
name = "franz mueller" print(name.title())
15th Dec 2019, 8:42 PM
rodwynnejones
rodwynnejones - avatar
+ 2
def(s): str1= s.split(' ') return ' '.join(words.capitalize() for words in str1)
15th Dec 2019, 8:46 PM
Subhash Kumar
Subhash Kumar - avatar
15th Dec 2019, 8:27 PM
Coding Cat
Coding Cat - avatar
15th Dec 2019, 8:40 PM
Coding Cat
Coding Cat - avatar
+ 1
Ohh yeah sry Thomas
15th Dec 2019, 8:58 PM
Subhash Kumar
Subhash Kumar - avatar
+ 1
Is not a problem. Only a hint for other beginners
15th Dec 2019, 8:59 PM
Coding Cat
Coding Cat - avatar
0
Or do you have the full name in only one variable?
15th Dec 2019, 8:30 PM
Coding Cat
Coding Cat - avatar
0
Yeah i found it , there is a capitalize() method which changes first letter of word in uppercase if there is alphabet ,if it's numerical then it leave as it
15th Dec 2019, 8:32 PM
Subhash Kumar
Subhash Kumar - avatar
0
Thomas , it is in one variable
15th Dec 2019, 8:33 PM
Subhash Kumar
Subhash Kumar - avatar
0
Yeah i also posted the code ..we can use that for many words
15th Dec 2019, 8:42 PM
Subhash Kumar
Subhash Kumar - avatar
0
That's good 👍 rodwynnejones And this one works also for many words
15th Dec 2019, 8:46 PM
Coding Cat
Coding Cat - avatar
0
Yup
15th Dec 2019, 8:49 PM
Subhash Kumar
Subhash Kumar - avatar
0
Now its fine
15th Dec 2019, 9:00 PM
Subhash Kumar
Subhash Kumar - avatar
0
Subhash Kumar This works fine. But I think, the function needs a name. instead of def(s): Something like this def cap(s): for examle
16th Dec 2019, 10:16 AM
Aitodev
Aitodev - avatar