9. Move it on back


#1

This is what I have so far it displays error message: Oops, try again. It looks like new_word equals "ay" instead of "hellohay"!

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
 print original
 word = original.lower()
 print "Word is: " + word
 first = word[0]
 new_word = first
 new_word = word
 new_word = pyg
 print "First is: " + first
else:
 print 'empty'

#2

lets say i have 3 variables:

a = 'a'
b = 'b'
c = 'c'

now i could join this:

joined = a + b + c

now joined is 'abc', i could also the following:

joined = a
/* now joined is 'a' */
joined = b
/* now joined is 'b' */
joined = c
/* now joined is 'c' */

print joined will not give c. This is what you have done with your new word variable, you overwrote new_word each time, rather then join it using plus signs (a + b + c)


#3

now it says for the error Oops, try again. Oops! Did you accidentally delete the word variable?


#4

I figured it out thanks for the help