subject

Write a program that prompts the user for a filename. Open the file, and read it one line at a time. For each line split the line into a list of words called line_list. For each word in the current line_list, look to see if it is in a list called script_list (a list that is initially empty). If the word is not in script_list, add it to the script_list. Sort the script_list alphabetically. Within the same program define a function called freq_count(). This function accepts a str and a list of words as arguments. It traverses the list of words and searches each word and counts the occurrences of the substring str within each word. Print each word along with the number of substring occurrences found within the associated word. Please note that you are not counting the number of occurrences in the file!Modify your program so that it accepts the filename and the substring str as input from the user. After reading the file to build and sort the script_list, pass the script_list into the freq_count() function.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 10:00
Install and use wireshark program ( send back screen shots and other vital information) case project 3-2: decode a tcp segment in a wireshark capture in this chapter, you walked through tcp segment to interpret the data included in its header. in this project, you use wireshark to capture your own http messafes, examine the tcp headers, and practice interpreting the data you'll find there. 1. open wireshark and snap the window to one side of your screen. open a browser and snap that window to the other side of your screen so you can see both windows.
Answers: 2
question
Computers and Technology, 24.06.2019 01:30
Hazel has just finished adding pictures to her holiday newsletter. she decides to crop an image. what is cropping an image?
Answers: 1
question
Computers and Technology, 24.06.2019 02:00
How are we able to create photographs differently than 100 years ago? explain your answer in relation to your photograph you selected.
Answers: 1
question
Computers and Technology, 24.06.2019 04:30
Fall protection, confined space entry procedures, controlled noise levels, and protection from chemical hazards are some of the things that contribute to a safe what
Answers: 1
You know the right answer?
Write a program that prompts the user for a filename. Open the file, and read it one line at a time....
Questions
question
Mathematics, 11.05.2021 23:50
question
History, 11.05.2021 23:50
question
Mathematics, 11.05.2021 23:50
question
Mathematics, 11.05.2021 23:50
question
Mathematics, 11.05.2021 23:50
question
Mathematics, 11.05.2021 23:50
Questions on the website: 13722367