I am making a program that analyzes text from a user
After inputting several line and using the keyword "DONE", the program will ask for one of 8 possible options which is the menu() function where the user will enter the number. How would i be able to run my program using main() function to where the user will be able to enter a choice have the text analyzed according to my functions and then be prompted again until they choose to quit the program. Also a choice of numbers under 1 or greater than 8 must not work for the menu. I know its alot but im stuck!
#DONE indicates the end of input
def input():
line = ""
dl = []
while line != "DONE":
line = raw_input("")
if (line != "DONE"):
nl = ""
for char in line:
if char.isalpha():
nl += char
else:
nl += " "
ll = nl.split()
dl.append(ll)
return dl
def long():
dl = input()
zz = []
for line in dl:
for word in line:
zz.append(word)
print max(zz, key=len)
def short():
dl = input()
zz = []
for line in dl:
for word in line:
zz.append(word)
print min(zz, key=len)
def common():
dl = input()
zz = []
for line in dl:
for word in line:
zz.append(word)
distinct_words = []
counter = []
for word in zz:
if word not in distinct_words:
distinct_words.append(word)
counter.append(1)
else:
index = distinct_words.index(word)
counter[index] += 1
print distinct_words
print counter
return 0
def fL():
dl = input()
single_list = []
for i in range (0,len(dl)):
single_list = single_list + dl[i]
char_list = []
for word in single_list:
char_list.append(str(word[0])
print char_list
def last():
dl = input()
single_list = []
for line in dl:
single_list.append((line[-1]))
print single_list
def total():
dl = input()
zz = []
for line in dl:
for word in line:
zz.append(word)
wordcount = len(zz)
print wordcount
def trd():
dl = input()
zz = []
for line in dl:
for word in line:
zz.append(word)
twords = zz[2::3]
print twords
def quit_program():
print "END"
quit()
def menu():
print
print "Choose an option"
print "1. Longest word"
print "2. Shortest word"
print "3. Most common word"
print "4. First let of each word"
print "5. Last word of each line"
print "6. Total words"
print "7. Third words"
print "8. End Program"
def main():
main()