Upper case first letter of each word in a phrase

前端 未结 10 1576
栀梦
栀梦 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:59

    #here is my trial, brief and potent!
    str = 'Self contained underwater breathing apparatus'
    reduce(lambda x,y: x+y[0].upper(),str.split(),'')
    #=> SCUBA
    

提交回复
热议问题