I'm currently making a program that saves the longest and shortest words in a sentence inside a list but i cant seem to append multiple words in a list as well as enter multiple sentence and only stop after a specific text or number is inputed. Python gui still confuses me alot.
class Find:
def long(self):
inputsentence = raw_input("Write a sentence: ").split()
long = []
for word in inputsentence:
if len(word) == len(max(inputsentence, key=len)):
long.append(word)
print long
def short(self):
inputsentence = raw_input("Write a sentence: ").split()
short = []
for word in inputsentence:
if len(word) == len(min(inputsentence, key=len)):
short.append(word)
print short
print "Pick shortest or longest"
print "[L]ongest"
print "[S]hortest"
f=Find()
while 1:
choice = raw_input('Enter choice: ').lower()
if choice == "l":
f.long()
elif choice == "s":
f.short()
else:
print "Invalid choice!"