Ok, I\'m trying to figure out how to make a inputed phrase such as this in python ....
Self contained underwater breathing apparatus
output
Pythonic Idioms
Implementation:
input = 'Self contained underwater breathing apparatus'
output = ''.join(word[0] for word in input.split()).upper()
def myfunction(string):
return (''.join(map(str, [s[0] for s in string.upper().split()])))
myfunction("Self contained underwater breathing apparatus")
Returns SCUBA
s = "Self contained underwater breathing apparatus"
for item in s.split():
print item[0].upper()
I believe you can get it done this way as well.
def get_first_letters(s):
return ''.join(map(lambda x:x[0].upper(),s.split()))