10 / 11 Ending Up *Need help *


#1

Please help. I am very confused and it says "File "python", line 9
new_word = [1:len(new_word)]
^
SyntaxError: invalid syntax" when I submit the code please explain what i am doing wrong.

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


#2

new_word=new_word[1:len(new_word)]


#3

Thanks @sokolovaa :grinning:


#4

Oops, try again. word should contain the .lower()-case version of original.


#5

Here's my code with comments to help you understand what that means

pyg = 'ay'

original = raw_input('Enter a word:')

#ensures text entered as original has greater than 0 characters and is a word (uses letters) instead of a digit
if len(original) > 0 and original.isalpha():
    print original
else:
    print 'empty'

#converts original word to its lowercase form    
word = original.lower()

#takes first letter of word and stores it
first = word[0]

#stores lower case word, adds first letter and then pyg. Word should print as "wordway"
new_word = word + first + pyg

# prints new word for debugging purposes
print new_word

#prints everything after position 0 in length of word
new_word=new_word[1:len(new_word)]

#prints new work for debugging purposes
print new_word

#6

Ok thank you but im still having the same problem.


#7

oh ok i figured out the problem


#8

Thanks for the help! I was viewing this over and it got me a lot closer to my answer. :+1:


#9

this is very hard and i need lots of help ,,,,,,,,,,,,,,,,,,,,


#11

why is there no spaces here?

    new_word = word + first + pyg
    new_word=new_word[1:]

Whats the difference here?


#12

ok, you picked out the first character with ---> word[0]
now what do you do with the ---> rest of the word and len?
this one can take a little imagination

like maybe ignoring certain parts of the instructions (didnt find them helpful in this one) and use your own variable called rest with len() :smiley:

first = word[0]
rest = ?


#13

oooohhh my god it worked liquidacidity thank you so much it had been on it for so long with me and my friends. we thank you :smile: :smile: :smile: :smile:


#14

it works every body use liquidaciditys way it works :smile: :smile:


#15

new_word=new_word[1:len(new_word)]

Why is there not spaces beside the =


#16

the first one is making a new variable named new_word and setting it to what the variables word, first and pyg have stored.
so...
word = 'python'
first = 'p'
pyg = 'ay'

new_word = pythonpay

The second line re-assigns new_word to be the previous word, starting from index 1

        0 1 2 3 4 5 6 7 8 9

new_word= P_y_ t_ h_ o_ n_ p_ a_ y

new_word[1:] =ythonpay


#17

It should look something like this

if len(original) > 0 and original.isalpha():
word = original.lower()
first = word[0]
new_word = word + first + pyg
new_word = new_word[1:] # this can also be 'new_word = new_word[1: len(new_word)]'
print original
else:
print 'empty'


#19

I did it a little differently because this made more sense to me

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
    word = original.lower()
    first = word[0]
    end = word[1:]
    new_word = end + first + pyg
    print new_word
else:
    print 'empty'`indent preformatted text by 4 spaces`

#20

Your code is great! It's so much simpler and more logical than what the tutorial is guiding us toward.


#21

What am i supposed to write in the console window? I tried original and new_word but neither of them worked.


#22

@swaglevelsohigh

You are supposed to translate the word using

word = 'Chickens'
new_word = word[1:] + word[0] + 'ay'
print(new_word.title())

Once you translate the word, that is when you should print or return the word so that you can work with the data.