Answer:
The function in Python is as follows:
def search_file(filename,mystring):
my_dict = {}
count = 0
file = open(filename)
lines = file.readlines()
for line in lines:
count+=1
if mystring.lower() in line.lower():
my_dict[count] = line.rstrip('\n')
return my_dict
Explanation:
This defines the function
def search_file(filename,mystring):
This initializes an empty dictionary
my_dict = {}
This initializes the number of lines to 0
count = 0
This opens the file
file = open(filename)
This reads the lines of the file
lines = file.readlines()
This iterates through the lines
for line in lines:
This increments the number line
count+=1
This checks if the string exists in the line
if mystring.lower() in line.lower():
If yes, the line number and the string are added to the dictionary
my_dict[count] = line.rstrip('\n')
This returns the dictionary
return my_dict
Answer:
A site where the author's information and qualifications are listed
Explanation:
When conducting online research, it is recommended that you look for reliable sources that will provide concrete evidence based on credible results. Credibility, in most cases, will start with the authors of the articles. Look for articles written by renown and respected authors. Evaluate keenly and avoid Wikipedia authors who are mostly anonymous. Determine their expertise, and if you can, do an additional Google research on them and find out whether they are credible or not.
Answer:
Javascript, because of the use of commas at the end of each line and the while operator using commas to hold params.
Answer:
import os
import nltk
import zipfile
from nltk. corpus import gutenberg
from nltk. text import Text
def findWordFreq(text, word):
textfreq = nltk. FreqDist(text)
wordfreq = nltk.FreqDist(word)
maxfreq = max(textfreq)
return wordfreq, maxfreq
if -_name__ == '__main__':
text = input()
word = input()
if not os.path.exists(os.getcwd() + "/nltk_data"):
with zipfile.ZipFile("nltk_data.zip", 'r') as zip_ref:
zip_ref.extractall(os.getcwd())
os.environ['NLTK_DATA'] = os.getcwd() + "/nltk_data"
text = Text(gutenberg.words (text))
word_freq, max_freq = findWordFreq(text, word)
print(word_freq)
print(max_freq)
Explanation:
The natural language package in python is used to get and analyse word from voice input. The python code above get words from a zipfile extract, and the 'findWordFreq' function gets the word count and the maximum number of alphabet used in the word distribution.
Answer:
Possibly because the ink ran out or it wasn't plugged in. Or it could've been set up or just a flat out broken printer.
Explanation: