I just dont understand what i have to do [PygLatin]


#1

Im from germany, my english is not that good (im horrible at understanding people if they dont try to speak loud and clear, but reading english text is fine) and i guess i understand the words but i still dont know what i have to do. Everything i try is wrong.


https://www.codecademy.com/courses/python-beginner-2W5v7/1/4?curriculum_id=4f89dab3d788890003000096#


Replace this line with your code.


#2

Hello @aerthur,

Please could you post the code you tried out and the error(s)?

Thank you. :slight_smile:


#3

the instructions are:
Set new_word equal to the slice from the 1st index all the way to the end of new_word. Use [1:len(new_word)] to do this.

and since i dont get it and dont know what to do, i just throw [1:len(new_word)] into the code

pyg = 'ay'

original = raw_input('Enter a word:')

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

else:
print 'empty'

and it says

Oops, try again.
Your code did not run to end - see the console window for the error message.

File "python", line 6
[1:len(new_word)]
^
SyntaxError: invalid syntax

as i said, i dont know what to do T_T


#4

Okay, the issue is in this block:

You can do this:

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)]
    print original

That said, I should also say,

new_word = new_word[1:len(new_word)]

will be the same as doing:

new_word = new_word[1:]

because it means same. :slight_smile:


#5

Thanks man, i think i understood what it does. Just one correction:

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)]
print new_word <------ ONLY THIS IS NEW

else:
print 'empty'

so it doesnt print "test" when my word is "test" but prints "esttay" :slight_smile:


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.