Question: post woth code and output pls. jython only. explanation. PROBLEM 3: Red and White Both Excite Function Name: waldoColors() Parameters: - filename - a string



PROBLEM 3: Red and White Both Excite Function Name: waldoColors() Parameters: - filename - a string representing the name of the file we want to read from Return Value: None Description: Our favorite man, Waldo, is known by his signature colors: red and white. Because of this, you associate every " r " and " w " as representatives of his colors and you want to count how often they occur in various text files. Write a code that will count the number of r 's and w 's in any .txt file, and then will write a new text file that will multiply the words "red" and "white" by the number of times they occur in the original file. Underneath this, print the word "Waldo!" multiplied by the product of number of "reds" and "whites." **Hint: must be case insensitive **Additional hint: note the name of the newly created files Test Cases: waldoColors ("waldo.txt") redWhitewaldo.txt red red res red red red red red white white white white white white unite white white white wilte white white white ahite white moite white white Watdo IMatoa Watdo PROBLEM 4: Going to Find Waldo Function Name: diaryEntry() Parameters: - myList- a list containing lists Return Value: None Description: You have decided to adventure out into the world to find Waldo. To keep track of everything that you do each day, you decide to keep a diary of your activities. To do this, you need to write a code that will add your daily diary entries (from "myList") into a new file called "dailyActivities.txt". **Note: The length of myList and its entries may vary from test case to test case ** Note: Consider using a loop within the loop iterating through myList to then iterate through the individual elements of the current list item. We call a loop within a loop a nested loop. Test Cases: diaryEntry ([ "Went to the movies", "Scoured the park", "Poured over a book"], ["Ran away from home", "Fought a dragon", "Took a phap"], ["Made a sculpture", "Posted wanted ads", "Found an impersonator"] f) PROBLEM 5: Hidding Letters Function Name: hidingLetter() Parameters: - filename - file representing what we want to read from. - letter - letter we want to remove Return Value: None Description: Oh no! Looks like the letters of files are following in the footsteps of their hero Waldo and hiding from the files. Given a file and a letter, write a new file that is the same as the original file with all instances of the specified letter now removed from the file. Name the file: 'ffilename\}Sans\{Letter\}.txt'. Example: hidingLetter("waldo.txt", "w") would generate a new file called 'waldoSansw.txt'. Note: Your code must be case-insensitive. Hint: How can we get the first part of filename without the extension. No slicing! What character should we stop looping at? Test Cases: hidingletter ("waldo.txt", "w") waldosansw.txt aldo ears a red and hite shirt. aldo is saarti the real question is, hy does aldo keep getting lost? here does ousto live? hat does aldo call hone? PROBLEM 5: Hidding Letters Function Name: hidingLetter() Parameters: - filename - file representing what we want to read from. - letter - letter we want to remove Return Value: None Description: Oh no! Looks like the letters of files are following in the footsteps of their hero Waldo and hiding from the files. Given a file and a letter, write a new file that is the same as the original file with all instances of the specified letter now removed from the file. Name the file: 'ffilename\}Sans\{Letter\}.txt'. Example: hidingLetter("waldo.txt", "w") would generate a new file called 'waldoSansw.txt'. Note: Your code must be case-insensitive. Hint: How can we get the first part of filename without the extension. No slicing! What character should we stop looping at? Test Cases: hidingletter ("waldo.txt", "w") waldosansw.txt aldo ears a red and hite shirt. aldo is saarti the real question is, hy does aldo keep getting lost? here does ousto live? hat does aldo call hone
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
