I'm a beginning coder learning from Codecademy. I'm using Python 2(because that's what Codecademy teaches). I'm building a pyg latin translator based off of the lesson on Codecademy except I'm making it so you can translate phrases rather than a single word. The problem I'm having is with my code that makes it so you can leave a blank when it asks to do one word, next word, etc. All of them work except for the fifth word, and what it does is it allows you to leave it blank but it doesn't allow you to input a word. Here is my code:
pyg = "ay"
original = raw_input("Please enter a word:")
second = raw_input("Please enter a second word:")
third = raw_input("Please enter a third word:")
fourth = raw_input("Please enter a fourth word:")
fifth = raw_input("Please enter a fifth 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)]
if len(second) > 0 and second.isalpha():
word_two = second.lower()
second_two = word_two[0]
new_word_two = word_two + second_two + pyg
new_word_two = new_word_two[1:len(new_word_two)]
if len(third) > 0 and third.isalpha():
word_three = third.lower()
third_two = word_three[0]
new_word_three = word_three + third_two + pyg
new_word_three = new_word_three[1:len(new_word_three)]
if len(fourth) > 0 and fourth.isalpha():
word_four = fourth.lower()
fourth_two = word_four[0]
new_word_four = word_four + fourth_two + pyg
new_word_four = new_word_four[1:len(new_word_four)]
if len(fifth) > 0 and fifth.isalpha():
word_five = fifth.lower()
fifth_two = word_five[0]
new_word_five = word_five + fifth_two + pyg
new_word_five = new_word_five[1:len(new_word_five)]
if len(original) == 0:
new_word = original
if len(second) == 0:
new_word_two = second
if len(third) == 0:
new_word_three = third
if len(fourth) == 0:
new_word_four = fourth
if len(fifth) == 0:
new_word_five = fifth
So the problem is with the very last bit of code, the "if len(fifth) == 0"... the first four work just fine, but the last one seems to be cancelling out the new_word_five variable up where it shows "new_word_five[1:len(new_word_five)]. Please help... I'm a very noob beginner and this is my first program I'm doing by myself.