FAQ: Learn Python - Pyglatin - Testing, Testing, is This Thing On?

Community%20FAQs%20on%20Codecademy%20Python%20Exercises

This community-built FAQ covers the “Testing, Testing, is This Thing On?” exercise in Codecademy’s lessons on Python.

FAQs for the Codecademy Python exercise Testing, Testing, is This Thing On?:

Join the Discussion. We Want to Hear From You!

Have a new question or can answer someone else’s? Reply (reply) to an existing thread!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources about Python in general? Go here!

Want to take the conversation in a totally different direction? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account, billing, Pro, or Pro Intensive? Reach out to our support team!

None of the above? Find out where to ask other questions here!

Other FAQs

The following are links to additional questions that our community has asked about this exercise:

  • This list will contain other frequently asked questions that aren’t quite as popular as the ones above.
  • Currently there have not been enough questions asked and answered about this exercise to populate this FAQ section.
  • This FAQ is built and maintained by you, the Codecademy community – help yourself and other learners like you by contributing!

Not seeing your question? It may still have been asked before – try (search) in the top-right of this page. Still can’t find it? Ask it below by hitting the reply button below this post (reply).

2 posts were split to a new topic: No spaces?

What’s wrong when I use :
“”"
for x in range(1, len(word)):
new_word[x-1]=word [ x ]
new_word [ x ] =first
“”"
to put the first word to last place?
P/S: error appears after enter word, the error comment is
“”"
Traceback (most recent call last):
File “python”, line 14, in <module>
TypeError: ‘unicode’ object does not support item assignment
“”"

This is my code

pyg = ‘ay’

original = raw_input(‘Enter a word:’)

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

and regardless of what I type in (whether the whole alphabet or just a word) it will print empty everytime, heeeelllppppp Y_Y

1 Like

Be sure the indentation in both blocks of the if statement are the same.

if ...:
    # code
else:
    # code

I just checked and it is, I’ve also tried refreshing the exercise and it’s still the same -.-"

It might look the same, but one could be a tab, and the other spaces. Suggest redo all the indentation manually using space characters (2 or 4).

Oh I tried that too and yet it still doesn’t work -.-’’

Try commenting out the raw_input line and enter the original manually…

original = 'surprise'

If I put two words into my PygLatin translator, I get empty - why is that?

Because a space character is non-alpha. The program is reading a string and expecting all alpha characters, meaning, one word.

1 Like

This is my code and for some reason it doesn’t change the word I type, which is my name, to anything it just comes out the same way I put it in.

pyg = ‘ay’

original = raw_input(‘Enter a word:’)

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

@tyetech, when you post code, please preserve the (required, not optional) indentations by making use of the </> icon that is in the menu bar atop the text box you are typing in.

I don’t see where you have asked your script to show you any output other than the word you typed in and the word “empty”.

For anyone that has the same problem in the future I had the exact same code and problem and after commenting out the original = raw_input(‘Enter a word:’) and manually entering *original= ‘hello’ * the exercise worked fine, so it had to do with the line I commented out.
I forgot to add a space between the : and ’ after Enter a word, and since it is also missing here perhaps it was the same issue

1 Like

print statement in the end of ‘if’ before else.

In the final concatenation of the ‘if’ statement, I was wondering why we would use [1:len(new_word)] instead of [1:len(word)]. It seems that using ‘new_word’ would confuse Python and using ‘word’ would not because word has already been defined while new_word is currently being defined. I am not putting my code as I am assuming that you all know the code being referenced. Please ask for the code if that is not the case.

Not going to happen. Python always does what it is told. No thinking involved, so no confusion, either.

We use new_word because that is the variable being printed. We’ve moved on from word.

It’s also moot, since we can write the slice as complete from index,

new_word[1:]

but the author wanted us to see the literal form before demonstrating the abstraction of it.

print new_word because the tranlator stored the values in new_word
try this it will surely help you

I went through the whole Pyglatin without knowing what actually is going on. Whenever I successfully finish a task, the I’m told to type something in the translator. When I type something, nothing changes or pops up. When I don’t type anything but hit Enter instead, the word “empty” pops up. I have no idea if this is a bug or not. Im so lost, please advice.