Print First Letter of Each Word in a String in Python (Keep Punctuation Marks) -
first post site apologize if wrong. have looked appropriate answer, not find one.
i new python , have been playing around trying take long string (passage in book,) , printing first letter of each word while keeping punctuation marks (though not apostrophe marks.) , have been unsuccessful far.
example:
input = "hello, i'm writing sentence. (though not one.)"
code....
output = h, w s. (t n g o.)
--note ",", ".", "()", not " ' ".
any tips? thank taking time look
to on adventure, i'll give step-by-step logic of it
in python first use .split() seperate spaces
go through each string in list
go through every char in string
print punctuation marks specify , first alphabetical character find
Comments
Post a Comment