I've no idea what I'm doing wrong


#1


The error is at line 10 and it's telling me invalid syntax.

I imagined that it would run normally.


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


#2

looks like you are trying to splice a string here but you did not provide the string you want to splice.
Take a look at the example below on splicing

#splicing example
sample_string = "Codeacademy"

#Take the first 4 characters from sample_string
spliced_sample = sample_string[:4]

print spliced_sample #'Code'

Hope this helps


#3

Thank you. I couldn't really figure that out for some reason. Oh well.


#5

pyg = 'ay'

original = raw_input('Enter a word:')

length

if len(original) > 0 and original.isalpha():

setting your word to a lower case and a variable

word = original.lower()

setting the first letter of your word

first = word[0]

putting the strings together

new_word = word + first + pyg

redefining your newword and taking out the 1st letter

new_word = new_word[1:len(new_word)]

print

print something

else:
print 'empty'


#6

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