Pr0cl1v1ty Pr0cl1v1ty - 2 years ago 80
Python Question

How do I find the first letter of each word?

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

Self contained underwater breathing apparatus

output this...


Which would be the first letter of each word. Is this something to do with index? and maybe a .upper function?

Answer Source

Here's the quickest way to get it done

input = "Self contained underwater breathing apparatus"
output = ""
for i in input.upper().split():
    output += i[0]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download