PygLatin Code keeping previous raw_input and not using new!


#1

PYGLATIN TRANSLATOR DOES NOT USE NEW ‘RAW_INPUT’ BUT PREVIOUS INPUT.

https://www.codecademy.com/courses/learn-python/lessons/pyglatin/exercises/testing-testing-is-this-thing-on-

My code will not use the raw_input that I enter when I hit run, instead it is using the previous input. So if I put in ‘Bob’ it will give me ‘obbay’ the first time but if I run it a second time to test a new word say ‘pie’ I get ‘obbay’ not ‘iepay’ if I run it again and put in ‘pie’ I will get ‘iepay’ but it isn’t giving me that the first time I put in a new word.

Just wanting to know if it’s my code or if it’s something to do with the exercise malfunctioning?

```python

Here is my code:

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

<do not remove the three backticks above>

#2

Hi @fossilitic,

This statement is in the wrong place …

new_word = word[1:len(word)] + first + pyg

Notice that it depends upon the values of the variables word and first, and therefore will not execute correctly until those variables have been assigned values.

Place the statement after this one …

    first = word[0]

#3

I was wondering if that might have been the problem. The instructions in the exercise were a little vague on where to place that line. Seems pretty logical NOW. Thanks for taking a look.


#4