Upper case first letter of each word in a phrase

前端 未结 10 1592
栀梦
栀梦 2020-12-03 21:08

Ok, I\'m trying to figure out how to make a inputed phrase such as this in python ....

Self contained underwater breathing apparatus

output

10条回答
  •  被撕碎了的回忆
    2020-12-03 21:46

    Another way which may be more easy for total beginners to apprehend:

    acronym = input('Please give what names you want acronymized: ')
    acro = acronym.split() #acro is now a list of each word
    for word in acro:
        print(word[0].upper(),end='') #prints out the acronym, end='' is for obstructing capitalized word to be stacked one below the other
    print() #gives a line between answer and next command line's return
    

提交回复
热议问题