I am looking a way to assign value to printed sentence to capitalize the first letters. The output should be: "Hello World!". This is my current code and the answer is "HELLO NEW WORLD" as a.title capitalizes every letter:
well='13H3e1llo0 312w20orl3d!432'
for a in well:
if a.isnumeric()==False:
print(a.title())
Any thoughts?
Here,
a.title()works perfectly if we havea='hello world'but here you have used aforloop which means.title()is invoked for each alphabetical character and capitalizes it. We con do this way:Hope you find it useful.