Question: code this in python3 pls 1)Write a function called longestWord() that takes a filename (string) as an argument and returns the longest word in that
code this in python3 pls
1)Write a function called longestWord() that takes a filename (string) as an argument and returns the longest word in that file. Punctuation characters should not count towards the length of a word.
2)Write a function called writeLines() that takes a filename (string) and a list of strings as arguments and prints the given list to the given file. The function should replace the file if it already exists, and should create a new file if it does not already exist.
3) Write a function called followsWord() that takes a filename (string) and key-word (string) as arguments and returns a list of all unique words that follow the given keyword in the file. E.g. If the textfile contained "She sells sea shells by the sea shore", followsWord(textfile, "sea") would return ['shells','shore']. Both the keyword and the text of the file should be considered case insensitive. Note: your code should not crash in the case that the keyword is the last word in the file.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
