Ending Up


#1

Help

pyg = 'ay'

original = raw_input('Enter a word:')
word = original.lower()
first = word[0]
new_word = word + first + pyg
new_word = new_word[0:]
if len(original) > 0 and original.isalpha():
print (new_word[1:4])
else:
print 'empty'
No idea what to do. please help me out!


#2

Don't just print out the word from 1:4, but rather 1:end of word :slightly_smiling:

print (new_word[1:len(new_word)])


#3

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

dont understand why it wont work
Edit : all good just missed something obvious


#5

This worked for me, but the lesson didn't make it clear at all that this is what I was supposed to type. I feel like the majority of issues stem from the ambiguous writing of the lessons....


#8

im having an issue with my code

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

i get an error message
File "python", line 11
else:
^
SyntaxError: invalid syntax
anyone know how to fix it,i've been getting this error since the beginning of the course


#9

Did you write it like this (with indentations)?

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

#10

yes, it keeps saying that the
else:
is an syntaxerror


#11

it also always says : is a syntax error/invalid syntax


#12

Delete this line:

and instead of:

type this:

new_word=word[1:]+first+pyg

new_word will take the variable word, starting from the second letter adding the first letter and 'ay' at the end.

after that just print new_word and it should work fine :smiley:


#13

I agree, the instructions are not clear enough


#14

@frozentofu is on the right track. The instructions ask us to assign it back on the variable, then print.


new_word = new_word[1:len(new_word)]
print new_word