Help me code no wrky


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
    print 'empty'


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


Please explain? i have not coded in a while

  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

    print "empty"


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