Codecademy Forums

How can I know if my translator works properly?

I tried to but regardless of what I type in it prints just the word empty, nothing else

impossible to say what causes the issue without getting more information (like your code)

The only guess i can take is that spaces aren’t alphanumeric characters, so make sure not to use any spaces.

Oh sorry, for some reason I thought you can see my code.

It looks like this

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’

please see this topic:

How to ask good questions (and get good answers)

and then the bit about formatting your code (so i can see the indention).

i don’t see any other print statement except for printing empty, why is that?

Oh ok so the link to the page is: https://www.codecademy.com/courses/learn-python/lessons/pyglatin/exercises/testing-testing-is-this-thing-on-?action=resume_content_item

and the code looks like this

pyg = 'ay'

original = raw_input('Enter a word:')

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

and I’ve tried what has been suggested in the post about swapping o to a 1, and just playing with it in general, but I don’t think I understand what I don’t understand yet and what can be wrong?

where did i suggest that?

what is your question exactly?

Oh no I didn’t mean you suggested that I’ve just been reading the thread and I understood that someone tried that so I tried it myself.

So my exact question is how to make the PygLatin work? and what is wrong with my code that it doesn’t work now?

not working is such a vague definition, what is not working as expected? Is the output not printed? What?

So I meant it isn’t doing what I ask it to do, in the case of this exercise it isn’t giving me the desired output, so if I type in the word “manchester” it’s not turning it to anchestermay, it’s simply printing the word “empty” regardless of what I type in

unable to replicate issue:

image

i put your code in, and i don’t get empty. Are you sure you are not entering any spaces? They don’t count as alpha numeric characters

I’ve included a couple of hints in comments to your code above. Good luck && happy coding!

Thank you so much for sharing!!! Question: How would I have known to type this: out_word = new_word[1:len(new_word)]
instead of : new_word =new_word[1:len(new_word)]?

What you shared was not in the lesson.

Often times I check my work using the python 3.7.3 shell and it will work for checking for errors but behaves differentely than the terminal in codeacademy. Is there a terminal for python where it will behave the same as the one used in codeacademy?

If you take the free python course, its python2. so you could install python2.7.3 and use that. Then you have he same version as CC

I have the same issue. Can someone answer why? Is it limited to any amount of characters?