Help me code no wrky


#1



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


it keeps saying the : is wrong

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


I thought it would work fine


pyg = 'ay'

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


#2

The order of the second through fourth line of code is a little off. It should be inside the if statement.


#3

Please explain? i have not coded in a while


#4
  1. set pyg
  2. get user input
  3. validate user input
  4. ...set word
  5. ...set first
  6. ...set new_word
  7. ...set slice
  8. ...print new_word

else:
    print "empty"

#5

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