Question: python3: but this needs to be in a webbased form here is the form code: import cgi, cgitb cgitb.enable() print (Content-type: text/html ) def printForm(default):

 python3: but this needs to be in a webbased form here

is the form code: import cgi, cgitb cgitb.enable() print ("Content-type: text/html ")

def printForm(default): print ("") print ("Enter some stuff:") print ("") print (default)

python3: but this needs to be in a webbased form here is the form code:

import cgi, cgitb cgitb.enable() print ("Content-type: text/html ")

def printForm(default): print ("

") print ("Enter some stuff:") print ("") print ("") print ("

") def printTable(): form = cgi.FieldStorage()

print ("

") print ("") print ("".format( form.getvalue('paragraph') )) print ("") print ("
{}

")

def printLines(longstring): posOfNewLine = longstring.find(' ') while posOfNewLine != -1: item = longstring[:posOfNewLine] longstring = longstring[posOfNewLine+1:] posOfNewLine = longstring.find(' ') print ("Here's an item {}
".format(item)); print ("Here's the last item {}
".format(longstring));

def printLink(): print ("

") print ("") print ("

") # # main code below # #printTable() form = cgi.FieldStorage() input = form.getvalue('paragraph') printForm(input) if input: # only do the following if there is input printLines(input)

Requirements Write a python program that 'analyzes' a list of words supplied in a textarea as described on a later slide Your python code will generate both the form and the output. Analyzing requirements You must split the entire text area into a list of strings by spaces. (This is what split() does by default) (i.e. words in a paragraph) It will sort the words in ASCENDING lexicographical order and print the first 400 words in 10 columns. You have to count the number words in the text area and print that out. You have to determine the average word length of the words in the paragraph and print that out too. Sample output UnsortedThis', 'is', 'a', 'sentence', 'I', 'just', 'typed', 'in'] Sorted:[T, This', 'a', 'in', 'is', just, 'sentence', 'typed] There are 8 words The average word length is #####

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!