Ending up


#1

I don't know was the problem with my code, plz helpp

pyg = 'ay'
new_word = word + first + pyg
new_word = new_word{1:len(new_word)}
print new_word
word = "original"
word = word.lower()
original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
first = word[0]
print original

else:
print 'empty'


#2

Did you read the exercises properly? there isn't order in your code at all. Let's start firstly from the beginning:
-pyg variable is fine
-What goes ahead after the declaration of the pyg variable? if you read the exercise it says "On line 4, use raw_input("Enter a word:") to ask the user to enter a word. Save the results of raw_input() in a variable called original", nothing hard, what I don't understand is, how come new_word variable has been declared before original?
-After declaring the variable original, the exercise ask to write down an if/else statement "Add an if statement that checks that len(original) is greater than zero. Don't forget the : at the end of the if statement!If the string actually has some characters in it, print the user's word.Otherwise (i.e. an else: statement), please print "empty".", how did you declared the variable word before the if statement when at exercise #4 there is still no sign of the word variable?
Start from here, make some order with your code and read the exercise properly, read the hints and don't try rushing your coding just for the sake of it, read deeply cuz from your code it looks like you haven't read the instructions at all.


#3

Thank you very much bro :smile:


#4

You're welcome! if you need clarifications, explanations or any help let me know :smile:


#5

This works for me. And makes sense to me.

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


#6

dude it doesn't work


#7

i tried it and how did it work for you


#8

he/she doesn't have indents but it does work if you put them in the right place


#9

what should it look like with indents i cant work it out


#10

This should be your line 8, 9 and 10. Don't type (indented), of course.

8 (indented) new_word = word + first + pyg
9 (indented) new_word = new_word[1:len(new_word)]

10 (indented) print new_word

If it's not working, check that it is exact. Read carefully!