Help with PygLatin Ending up 10/11


#1


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

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


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 = [1:len(new_word)]
print new_word 
else:
print 'empty'


#2

please help i have been stuck on this exercise forever :head_bandage: im sooo confused!


#3

everything which should be in if or else statement should be intended:

if condition:
   # code in the if block
else:
   # code in the else block

in your case, the indention is missing, indention is crucial in python


#4

add + first + pyg

to this line,

so it would look like,

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

it should work after that :slight_smile:

Oh yea and indent everything correctly as @stetim94 said :grin:


#5

THANK YOU SO MUCH! THAT SEEMED TO DO THE TRICK :grinning: :grin: :kissing_smiling_eyes:


#6

You're welcome :slight_smile:


#7

but your indention seemed of, guess that was just a issue of copy pasting code to the forum

do you also understand why bandits solution work? you [] allows you to take a slice, but you need to add the square brackets after the variable you want to take a slice off.


#8

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