[Tutor] printing an acronym

R. Alan Monroe amonroe at columbus.rr.com
Sun Sep 25 01:51:52 CEST 2005


> Hello

> How could I get the following to print out an acronym for each phrase
> entered such as if I entered random access memory it word print out RAM?

> import string

> def main():


>     phrase = (raw_input("Please enter a phrase:"))

>     acr1 = string.split(phrase)


>     acr2 = string.capwords(phrase)


>     acr3 = acr2[0]

>     print"",acr3

> main()

What does it currently print?

The typical way would be to use a for loop on acr1.

Alan



More information about the Tutor mailing list