Ending up


#1

I'm also stuck there and ive done something like this but its not working.
pyg = 'ay'

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


Ending Up lesson question, multiple! [SOLVED]
#2

Ok so the example in this lesson is very misleading. You actually do not need an s statement of any kind to correctly code this lesson. I am going to give you a basic outline and instruction to how I solved this lesson. Someone else might be able to give you advice on your existing code to pass this lesson with your style of coding. However, for basic help this should help you. The first step is you need to have your if statement at the very beginning after original = raw_input so that you can have everything in the if statement. Next, put the print original below that and keep the word = original.lower() and first = word [0] and your new_word = word + first pyg right after this in that order. Then comes the key to the lesson. You need to make new_word equal to what and [1:len(new_word)] then print that. Then your else statement which is fine comes last. Overall here is your basic outline for this lesson:

pyg = 'ay'

original = raw_input('Enter a word:')

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

You had the right pieces but the s statement threw you off to what was really needed in the code to pass. Instead of printing and equaling something to s you really needed to do that to [1:len(new_word)]


#3

Thanks man you've really helped me


#4

No problem glad to help! Happy coding! :smiley:


#5

help me again, i've done the same thing you've told me but it's not running well


#6

Post your new code please so I can see it?


#7

pyg = 'ay'

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


#8

You almost have it!

Now, through out this exercise we have been using not word but what? Then you need to print that afterwords


#9

So i Use the first word i inputted


#10

This is the error i'm getting on the interpreter
Traceback (most recent call last):
File "python", line 9, in
NameError: name 'what' is not defined


#11

Yeah so what is obviously not the answer but new_word is. You need the new_word to equal new_word with [1:len(new_word)] and then on your next line you need to print this like this:

print new_word[1:len(new_word)]

#12

I've done that, the only thing that was missing is new_
thanks alot man, you've helped me alot.
now i continue my coding


#13

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