print ('my name is {}'. format ( 'parv'.title()).capitalize())
I want a result in which both 'm' and 'p' are capital
I want a result in which both 'm' and 'p' are capital
| I am a beginner |
| print ('my name is {}'. format ( 'parv'.title()).capitalize()) I want a result in which both 'm' and 'p' are capital Sep-26-2019, 04:01 PM 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' I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame. Sep-29-2019, 08:57 AM I got one more answer to this question: print ('my name is {}'.capitalize().format ( 'parv'.title())) |
| |