PygLatin 8.Word Up


#1

I don't understand what this should be doing:
pyg = 'ay'

original = raw_input('Enter a word:')
word=original.lower()
first=word[0]
if len(original) > 0 and original.isalpha():
print original
else:
print 'empty'

Shouldn't it make any word I enter into lowercase when it asks me to 'Enter a new word' and give me the first letter of that word?


#2

Hi javierleon50!

The assignments of variable values go from right to left, so, for example, let's say at the prompt

Enter a word:

I enter

Banana

so
original = 'Banana'
next
word = 'banana'
and
first = 'b'

But then you wrote

if len(original) > 0 and original.isalpha():
    print original

that means you will print original, that is, 'Banana'. In order to print the first letter, you would have to write

print first

I hope that helps!


#3

What about "Move It On Back". I typed the following:
pyg = 'ay'

original = raw_input('Enter a word:')
word=original.lower()
first=word[0]
new_word = word + first + pyg
if len(original) > 0 and original.isalpha():
print first
else:
print 'empty'

What should I type when it asks for "Enter a New Word" so that the concatenate function works properly?