Lesson 10 ending up


#1

my code:
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'
print original


#2

It's not a indentation error either. It just pasted like that.


#3

Hi this part

new_word = [1:len(new_word)]

before [1:len(new_word)] try to put new_word like that

new_word = new_word[1:len(new_word)]

how to format your code.


#4

Thanks for your help, I'm glad you like to help people on this coding forum because you've helped me multiple times.


#5

i have a couple of questions if someone can please help.
first questions why did i have to create theses functions within the if statement?

 pyg = 'ay'

 original = raw_input('Enter a word:')

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

#6

What do you mean? Those functions are translating the word to piglatin.


#7

Hi the if statment is here for:

1 for cheking if you type a something :

if len(original) > 0

2 for checking if you typed some word or a number:

original.isalpha():

like you can see we used and between len(original) > 0 and original.isalpha(): so if one them is false it will run the else statement

I Hope that could help you.