How can I know if my translator works properly?


#25

Can u plzz explain how does line work


#26

here:

https://www.pythoncentral.io/cutting-and-slicing-strings-in-python/

scroll down to the slicing bit.

you slice the first letter of the string, as part of the translation to pyglatin


#27

“If I enter a strictly alphabetical string, it returns the lowercase version with the first letter at the end of the normal word, followed by ‘ay’.”

Except it doesn’t. I’ve gotten tot he last section of the lesson, it’s passed me, and when I type in a word it returns that word exactly as I typed it with no amendments, lowercase, translated, or otherwise. I don’t understand how this is happening if I’ve been passed on the previous parts of the lesson.


#28

Never mind I worked it out - the original Print Original has to be changed to Print new-word. It doesn’t say to do this in any of the instructions. I get that I’m on the free version so it has limited help but this is negligence, I would pay for membership if the cost wasn’t extortionate…


#29

Hi,
when I try testing my code with strings having large number of characters say some 20, 26 etc some of the characters are getting cropped. Please see the screenshot for one sample and let me know it is expected.


#30

Really confused by this lesson. The code seems to work (in a way), however it’s only translating the word I input BEFORE the word I currently input. Example: if i type in Ear it doesn’t do anything, but then if i type in Dog, it then will display: areay (the translation for the previous word ‘ear’.

Here is my code. Hopefully someone can explain to me what is happening because even the solution code they provide doesn’t seem to differ from mine.

Thank you!

pyg = ‘ay’

original = raw_input(‘Enter a word:’)

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


#31

sounds like a glitch, what if you run the code on repl.it?


#32

Went to that site. It’s throwing all kinds of errors on things that work fine in the codecademy


#33

Did you pick the right python version? And if you want help, please be a bit more descriptive. You could share the repl with your code


#34

It looks to me like you’re printing ‘new_word’ before you defined it and gave it a value, in your fourth line of code. The new_word variable is given something to store from raw_input only after you tried to print it earlier. I’m guessing the first time you run it, it prints nothing. The second time you run your code, it does not find a new value for new_word, and therefore immediately prints the value that you had most recently/previously stored as new_word.