About 2 months ago I started studying python and then 3 days ago sat and began to write a program (found the dumbest & simplest thought I could: a pyglatin translator). I finally got it working 100%. Being a beginner I would love to hear some constructive criticism on my program; I know I have probably written more then was needed on some stuff and taken a long way around on others.
another_word = " "
sentence1 = " "
new_list = []
another = " "
def trans_one_word (i):
global another_word
pyg = 'ay'
original = (i)
if len(original) > 0 and original.isalpha():
word = original.lower()
first = word[0]
new_word = word + first + pyg
another_word = new_word[1:len(new_word)]
return another_word
else:
print('empty')
def input_state():
sentence = input("enter a word to be translated: ")
list = sentence.split()
for i in list:
trans_one_word(i)
new_list.append(another_word)
s = " "
print (s.join( new_list ))
input_state()
another = input("Would you like to enter another sentence to be translated? \n Y/N")
if (another == 'y') or (another == 'Y'):
input_state()
All in all I am proud of myself for actually writing it without any help, or all of it except the last "if" statement (I had minor problems with it).