Parens are unnecessary and you could just call the arg original
andas you don't really need this assignment.
def input_state():
sentence = input("enter a word to be translated: ")
Assume you meant to ask for a words or a sentence given the variable name:
list = sentence.split()
You should look into list comprehensions and generators as this couldcan be significantly simplified, e.g. print(" ".join(trans_one_word(i) for i in sentence.split()))
print (s.join( new_list ))
It's probably better to return this result and let the caller print
it.
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()
def trans_one_word(word):
pyg = 'ay'
if word and word.isalpha():
word = word.lower()
return word[1:] + word[0] + pyg
return word
def input_state():
sentence = input("enter a wordsentence to be translated: ")
return " ".join(trans_one_word(word) for word in sentence.split())
while True:
print(input_state())
another = input("Would you like to enter another sentence to be translated?\nY/N")
if another not in 'yY':
break