Ending up?


i can't understand what's wrong?
everything seems to be right, i am breaking my brain to find out why it ain't work

pyg = 'ay'

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


This line needs one level of indentation. Add four spaces in front and you're good.


Well, not really. The above advice is good, for that line. There are issues further above that need to be addressed.

Script reads top down, which means order matters. When we test for certain conditions it is critical to the end result. Order helps to remove assumptions


thanks! your advice was perfect and i passed it. what are the other issues? and also, when do i need to add the spaces?


Consider the test line,

if len(original) > 0 and original.isalpha():

Its purpose is to validate the raw input, not show up late to the party at the output stage. Unwanted guest at this point.



original = raw_input('Enter a word:')
if len(original) > 0 and original.isalpha():
    the_lot = '''
        all the code that fits the bill
        goes in this allotted space.
    print "empty"

with the else at the end.


got it :slightly_smiling: and last thing - what are the spaces for? and when should i put spaces?


In preformatted text they have no programmatic value. In Python code, they are block levels. Confuse that at one's own peril.


I'm sorry if this is confusing you. The spaces in some instances have no meaning, such as my pseudo variable, 'the_lot'. Replace this variable and all its contents with a block of code. All the stuff that previously was written above this line that should have followed it.


thank you very much!