Python Forum
I am a beginner - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: I am a beginner (/thread-21369.html)



I am a beginner - Wraith2102 - Sep-26-2019

print ('my name is {}'. format ( 'parv'.title()).capitalize())

I want a result in which both 'm' and 'p' are capital


RE: I am a beginner - perfringo - Sep-26-2019

You should move both parts into format:

>>> '{} {}'.format('my name'.capitalize(), 'parv'.title())
'My name Parv'
It's easier with using f-strings (3.6 and newer):

>>> f"{'my name'.capitalize()} {'parv'.title()}"
'My name Parv'



RE: I am a beginner - Wraith2102 - Sep-29-2019

I got one more answer to this question:

print ('my name is {}'.capitalize().format ( 'parv'.title()))