Using the Python language, have the function LongestWord(sen) take the sen parameter being passed and return the largest word in the string. If there are two or more words that are the same length, return the first word from the string with that length. Ignore punctuation and assume sen will not be empty.
def LongestWord(sen):
try:
list1 = []
list1 = sen.split()
dictLen = {}
for item in list1:
dictLen[item] = len(item)
list2 = dictLen.values()
list2.sort()
if len(sen)==0:
return 0
else:
return list2[-1]
except Exception, e:
print "error!"
print "input string:"
print LongestWord(raw_input())
inmput:"argument goes here"
output:8