Python Forum
Help with acroym creating - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Help with acroym creating (/thread-4106.html)



Help with acroym creating - n0003 - Jul-23-2017

I have a homework question that states the following:

An acronym is a word formed by taking the first letters of the words in a phrase and making a word from them. For example, RAM is an acronym for “random access memory.” Write a well-documented Python program that allows the user to type in a phrase and then outputs the acronym for that phrase. The acronym should be all uppercase, even if the words in the phrase are not capitalized.

But I'm stuck on it, I don't know if I am doing it right but this it was I have so far

#Ask for word
w = input("Type in word to create acronym with spaces between the words")

#Seperate the words to create acronym

s = w.split(" ")
letter = s[0]




#print answer

print s.upper(letter)



RE: Help with acroym creating - MTVDNA - Jul-23-2017

You are on the right track!

Let's split the problem up into smaller pieces. If you have a word, e.g. 'test', do you know how to get the corresponding letter (in this case 'T')?


RE: Help with acroym creating - ichabod801 - Jul-24-2017

You've got the first letter of the first word, you just need to loop over the words to get the first letter of each word. The loop would start with for word in w.split():.

Note that your task is to create a "well documented" Python program. I would not consider a program with one letter variable names to be well documented.