The Python program assigned at this time is to open a file and find the location of the given search keyword. The file is accessed by the user given path expression, which is a fully qualified path expression. The file is converted to a list, which contains list elements. An element in the list is each such a line in the file.
For each line of the file in the line list, another list is generated. This word list contains words, the words in a given line.
For each word of the word list, the given search keyword is compared. If matched, where the word is found is displayed.
Note that print statements are somehow sophisticated to display the match states sensitively and intelligently. See the sample run of how the match states are displayed for several different match cases.
Write a Python code to handle all tasks described above.
Consider the sample file:
This is a sample file demonstrating how this can be read in a Python attack code.
This Python example shows you in many ways a local file can be loaded in your computer and further manipulated.
Hope this helps you guys understand a for loop and a way of dealing files.
A trio of internet giants revealed on Tuesday that they had fought off an unprecedented distributed denial-of-service (DDoS) attack — used to disrupt the availability of systems like websites and services — that registered as the biggest on record, by far.
Cloudflare, Google and Amazon Web Services (AWS) said the attack relied on a previously undisclosed vulnerability in a key piece of internet architecture.
And it was massive.
The DDoS events AWS detected were a type of HTTP/2 request flood, which occurs when a high volume of illegitimate web requests overwhelms a web server’s ability to respond to legitimate client requests, Tom Scholl, vice president and distinguished engineer at the company, and Mark Ryland, AWS’s director of the office of chief information security officer, wrote in a blog post.
Because the attack abuses an underlying weakness in the HTTP/2 protocol, we believe any vendor that has implemented HTTP/2 will be subject to the attack,” Cloudflare engineers Lucas Pardue and Julian Desgats wrote. “This included every modern web server.
The novel nature of the attack vulnerability allowed for some interesting attack numbers. Cloudflare said it was three and a half times bigger than its previous biggest attack on record, while Google said it was seven and half times larger attack than the previous attack record.
A sample run:
>>> (executing cell “” (line 107 of “hw4.py”))
Enter the fully qualified path expression to the file name: /Users/jyoon/Johns-Backup/Mercy/505foundaCSEC/inClass/f23/sample1.data
Enter the word to search: attack
======= Summary: ‘attack’ is found 9 times: =======
In line# 1, ‘attack’ is the 15th word in [This is a sample file demonstrating how this can be read in a Python attack code.]
In line# 4, ‘attack’ is the 19th word in [A trio of internet giants revealed on Tuesday that they had fought off an unprecedented distributed denial-of-service (DDoS) attack — used to disrupt the availability of systems like websites and services — that registered as the biggest on record, by far.]
In line# 5, ‘attack’ is the 10th word in [Cloudflare, Google and Amazon Web Services (AWS) said the attack relied on a previously undisclosed vulnerability in a key piece of internet architecture.]
In line# 8, ‘attack’ is the 3th word in [Because the attack abuses an underlying weakness in the HTTP/2 protocol, we believe any vendor that has implemented HTTP/2 will be subject to the attack,” Cloudflare engineers Lucas Pardue and Julian Desgats wrote. “This included every modern web server.]
In line# 9, ‘attack’ is the 6th and the 12th and the 28th and the 41th and the 45th word in [The novel nature of the attack vulnerability allowed for some interesting attack numbers. Cloudflare said it was three and a half times bigger than its previous biggest attack on record, while Google said it was seven and half times larger attack than the previous attack record.]
Submission:
python code; no data file is needed.
Place this order or similar order and get an amazing discount. USE Discount code “GET20” for 20% discount