Write a function wordcount() that takes the name of a text file as input and prints the number of occurrences of every word in the file. You function should be case-insensitive so 'Hello' and 'hello' are treated as the same word. You should ignore words of length 2 or less. The results printed will be ordered from the most frequent to the least frequent. Hint: dictionary and list. Test your implementation on file great_expectations.txt

Answers

Answer 1

Answer:

Explanation:

The following Python program uses a combination of dictionary, list, regex, and loops to accomplish what was requested. The function takes a file name as input, reads the file, and saves the individual words in a list. Then it loops through the list, adding each word into a dictionary with the number of times it appears. If the word is already in the dictionary it adds 1 to its count value. The program was tested with a file named great_expectations.txt and the output can be seen below.

import re

def wordCount(fileName):

   file = open(fileName, 'r')

   wordList = file.read().lower()

   wordList = re.split('\s', wordList)

   wordDict = {}

   for word in wordList:

       if word in wordDict:

           wordDict[word] = wordDict.get(word) + 1

       else:

           wordDict[word] = 1

   print(wordDict)

wordCount('great_expectations.txt')


Related Questions

6. Where all controls are lie
a) Properties b) Toolbox c) Solution Explorer d) Files

Answers

Answer:

I think b is correct answer.

What is the importance of using Onedrive in Windows 10 and how knowledge of it will have an impact in today's workplace?

Answers

The importance of one drive in windows 10 is that it helps the user to synchronize files in their computer.

Onedrive is a cloud storage system that is useful for the storage of files in a secured manner. A person can easily access their files whenever they want to.

In todays workplace a knowledge of onedrive has a great impact because

Onedrive offers an unlimited access to files whenever they are neededThe files can be available and accessed from anywhereIt helps with the organization of files in the work place.

One drive allows for this to be done even when offline. When online, there is an automatic synchronization of the made changes.

Read more at https://brainly.com/question/17163678?referrer=searchResults

Windows 10's one drive is useful because it enables users to synchronize information among various computers.Onedrive is indeed a cloud storage solution that can be used to store data in a secure environment.The user gets easy access to their files when their desire.In today's workplace, knowing how to use OneDrive is necessary because it gives unrestricted access to files anytime they're needed.The information can be transferred anywhere at.It assists with the arrangement of files in the workplace.It can be done and if you're not linked to the Network. Once you're online, the modifications you've performed are synchronized immediately.

Learn more:

brainly.com/question/24369537

Arrays are commonly used to store data items. Arrays can be managed in ways that fill, iterate over, add to, and delete items from the array. Why is it useful to store multiple pieces of information?

Answers

Answer:

mark me brainlist

Explanation:

Give examples of applications that access files by each of the following methods:
+ Sequentially.
+ Random.

Answers

Answer:

Explanation:

Usually, applications would have the capability of using either one of these options. But for the sake of the question here are some that usually prefer one method over the other.

Any program that targets an API usually uses Sequential access. This is because API's contain all of the data as objects. Therefore, you need to access that object and sequentially navigate that object to the desired information in order to access the data required.

A music application would have access to an entire folder of music. If the user chooses to set the application to randomly play music from that folder, then the application will use a Random Access method to randomly choose the music file to load every time that a song finishes.

Mobile computing is growing in importance each and every day, and the IT manager must take that into account. Do some web research and develop a one-page description of the five most important things about HCI of mobile computing that the IT manager should know.

Answers

Answer:

phone grows everyday 82 percent

Explanation:

How to overcome software quality dilemma

Answers

Explanation:

anytime software and business come together there is an inherent conflict between get it done fast and do a good job

will social media lose its relevance?​

Answers

Judging from it's prevalence and popularity, there will be a long way to go until people start to lose interest with expressing themselves online. So no, social media will not lose its relevance, but maybe when technology is dead, then it will.

explain computer coding in an understandable manner​

Answers

Answer:

Coding is simply how we communicate with computers. Code tells a computer what actions to take, and writing code is like creating a set of instructions

Explanation:

Computer coding empowers kids to not only consume digital media and technology, but to create it. Instead of simply playing videogame or envision what their own website, or app might look like and they'll have the outlet for the expression

WHICH PROGRAMMING LANGUAGES ARE THE BEST AND COMPATIBLE FOR 3D PRINTERS?

Answers

Answer:

G-code and C++ can be used

In order to print multiple worksheets, what needs to happen before printing?

Answers

Answer:

Explanation:

Click the File tab.

Click Print, or press the control p keyboard command.

On the Print screen, select the printer and other settings.

Click Print.

This method adds newValue to the list at the specified index. If the index is invalid for the list, throw an IndexOutOfBoundsException. Note that the last valid index is the size of the list; this would mean adding to the back of the list. Call any existing methods of LinkedList and LLNode as needed.

Answers

Answer:

i dont know

Explanation:

A sinewave has a period (duration of one cycle) of 645 μs. What is the corresponding frequency of this sinewave, in kHz, expressed to 3 significant figures?


please help me figure this out I am so confused

Answers

The corresponding frequency of this sinewave, in kHz, expressed to 3 significant figures is: 155 kHz.

Given the following data:

Period = 645 μs

Note: μs represents microseconds.

Conversion:

1 μs = [tex]1[/tex] × [tex]10^{-6}[/tex] seconds

645 μs = [tex]645[/tex] × [tex]10^{-6}[/tex] seconds

To find corresponding frequency of this sinewave, in kHz;

Mathematically, the frequency of a waveform is calculated by using the formula;

[tex]Frequency = \frac{1}{Period}[/tex]

Substituting the value into the formula, we have;

[tex]Frequency = \frac{1}{645\; * \;10^{-6}}[/tex]

Frequency = 1550.39 Hz

Next, we would convert the value of frequency in hertz (Hz) to Kilohertz (kHz);

Conversion:

1 hertz = 0.001 kilohertz

1550.3876 hertz = X kilohertz

Cross-multiplying, we have;

X = [tex]0.001[/tex] × [tex]1550.39[/tex]

X = 155039 kHz

To 3 significant figures;

Frequency = 155 kHz

Find more information: https://brainly.com/question/23460034

How can an IS managers keep up with the endless demand for more software to support new information systems​

Answers

An IS manager can keep up with the endless demand for more software to support new information systems by thinking outside the box.

To think outside the box, the IS manager should try the following strategies:

Use predetermined application components that are operating on low-code or no-code platforms.Use better software-testing practices and tools that spread programming into small sprints.Engage in shift-left testing, which enables software-testing to be done at every phase of the development process.Involve product managers and business users at the beginning of software development, making them to drive innovation that satisfies their requirements.Finally, the IS manager can utilize AI and Machine Learning to speed up the development of required software, thereby enhancing its qualities and capabilities with reduced time and costs.

Thus, the IS manager must realize that there are always solutions to every software problem outside the mainstream box.

Learn more about information systems here: https://brainly.com/question/1521627

Which are the best networking projects for a final year student in college

Answers

Answer:

The best networking project for a final year are Security issues with mobile IP.IP based patients monitoring systems.

Where does change management play a major role in transforming a client
business into a data-driven, intelligent enterprise?

Answers

To manage a modern IT environment characterized by hybrid complexity and exponential data growth — and to make that same IT a driver of growth and innovation for the business — you need to build intelligence into every layer of your infrastructure.

Change management plays a major role in transforming a client  business into a data-driven, intelligent enterprise in: data culture and literacy.

Data culture and literacy refer to all the processes involved in analyzing and understanding data within the framework of an organization.

The employees within such organizations are trained to read and understand data. It becomes a part of the organization's culture.

So data culture and literacy should be used when trying to transform a client  business into a data-driven, intelligent enterprise.

Learn more about data culture here:

https://brainly.com/question/21810261

A _______ read inputs the first data item from a file. It typically appears immediately before the loop that processes the data from the file and inputs the remaining data from the file.

Answers

Answer:

the answer is priming read

Explanation:

hope it helps u

In database a record is also called a

Answers

Explanation:

hope it helps you

pls mark this ans brainlist ans

explain the working principle of computer? can anyone tell​

Answers

Answer:

input process and output hehe

Fasilitas untuk pengaturan batas kertas pada Microsoft Word adalah….

a. Margin
b. View
c. LayOut
d. Paragraph

Office 92 sering disebut juga dengan….

a. Office 3.0
b. Office 7.0
c. Office Xp
d. Office 2.0


Answers

Fasilitas untuk pengaturan batas kertas pada Microsoft Word adalah

B.View

Office 92 sering disebut juga dengan

A.Office 3.0

What is true about the pivot in Quicksort? Group of answer choices After partitioning, the pivot will always be in the center of the list. After partitioning, the pivot will never move again. Before partitioning, it is always the smallest element in the list. A random choice of pivot is always the optimal choice, regardless of input.

Answers

Answer:

The pivot is selected randomly in quick sort.

Consider a DataFrame named df with columns named P2010, P2011, P2012, P2013, 2014 and P2015 containing float values. We want to use the apply method to get a new DataFrame named result_df with a new column AVG. The AVG column should average the float values across P2010 to P2015. The apply method should also remove the 6 original columns (P2010 to P2015). For that, what should be the value of x and y in the given code?

Answers

Answer:

x = 1

y = 1

Explanation:

The apply method has the axis argument which enables it to use the applied function either across the rows or columns, by passing the value 1 to the axis argument, the mean of at each index is calculated, (across the column) such that the length of the AVG column is equal to the lengtb of the original dataframe.

The drop method is used in pandas to remove row or column entry from a dataframe. To remove columns from a data table, the value 1 is passed to the axis argument of the drop method. Hence, passing 1 to the axis argument removes all 6 columns leaving only the AVG column in result_df.

You have n warehouses and n shops. At each warehouse, a truck is loaded with enough goods to supply one shop. There are m roads, each going from a warehouse to a shop, and driving along the ith road takes d i hours, where d i is an integer. Design a polynomial time algorithm to send the trucks to the shops, minimising the time until all shops are supplied.

Answers

Following are the steps of the polynomial-time algorithm:

Split the routes according to their categorizationAssuming that mid = di of the middle road, low = road with the least di, and high = road with the highest di, we may do a binary search on the sorted list.All shops must be approachable only using these roads for every road, from low to mid.Check if all shops can be reached from[tex]\bold{ low \ to\ mid+1}[/tex] using only these roads.There is a solution if every shop can be reached by road only up to [tex]\bold{mid+1}[/tex], but not up to mid.You can [tex]\bold{set \ low = mid+1}[/tex] if all businesses aren't accessible using both [tex]\bold{mid\ and\ mid+1}[/tex] roads.If every shop could be reached using both mid and mid+1, then set high to mid-1.With these layouts of businesses and roads, no response can be given because [tex]\bold{ low > high}[/tex]You can do this by [tex]\bold{set\ mid = \frac{(low + high)}{2}}[/tex]The new low, mid, and high numbers are used in step (a).

In a minimum amount of time, this algorithm will determine the best strategy to supply all shops.

Learn more:

polynomial-time algorithm: brainly.com/question/20261998

Write a pseudocode For loop that displays all the numbers from 0 to 5, one at a time. We have the following pseudocode so far. Declare Integer number Write this statement Display number End For Type the exact text for the line of pseudocode that should replace Write this statement shown above.

Answers

Answer:

The statement is:

For number = 0 to 5

Explanation:

Given

The incomplete pseudocode

Required

The loop statement to complete the pseudocode

To loop from 0 to 5, we make use of:

For number = 0 to 5

Where:

number is the integer variable declared on line 1

So, the complete pseudocode is:

Declare Integer number

For number = 0 to 5

Display number

End For

Components of micro computer with diagram

Answers

Answer:

CPU, Program memory, Data memory, Output ports,  Input ports and Clock generator.

Explanation:

There are six basic components of a microcomputer which includes CPU, Program memory, Data memory, Output ports,  Input ports and Clock generator. CPU is the central processing unit which is considered as the brain of the computer. It is the part of a computer that executes instructions. Data memory is the place where data is stored that is present in the CPU.

During the testing phase of an ERP system, the system implementation assurers should review: Group of answer choices Program change requests Vendor contracts Error reports Configuration design specifications

Answers

Answer:

Error reports

Explanation:

ERP is a multimodal software system that integrates all business processes and the function's of the entire organizations into  single software system using a one database.

Discuss the OSI Layer protocols application in Mobile Computing

Answers

Answer:

The OSI Model (Open Systems Interconnection Model) is a conceptual framework used to describe the functions of a networking system. The OSI model characterizes computing functions into a universal set of rules and requirements in order to support interoperability between different products and software.

2. A computer that is easy to operate is called
I
10 POINTSSSS PLEASEEE HELPPP

DIT QUESTION

Answers

Answer:

Explanation:

A computer that is easy to operate is called User Friendly

Discuss the DMA process​

Answers

Answer:

Direct memory access (DMA) is a process that allows an input/output (I/O) device to send or receive data directly to or from the main memory, bypassing the CPU to speed up memory operations and this process is managed by a chip known as a DMA controller (DMAC).

Explanation:

A defined portion of memory is used to send data directly from a peripheral to the motherboard without involving the microprocessor, so that the process does not interfere with overall computer operation.

In older computers, four DMA channels were numbered 0, 1, 2 and 3. When the 16-bit industry standard architecture (ISA) expansion bus was introduced, channels 5, 6 and 7 were added.

ISA was a computer bus standard for IBM-compatible computers, allowing a device to initiate transactions (bus mastering) at a quicker speed. The ISA DMA controller has 8 DMA channels, each one of which associated with a 16-bit address and count registers.

ISA has since been replaced by accelerated graphics port (AGP) and peripheral component interconnect (PCI) expansion cards, which are much faster. Each DMA transfers approximately 2 MB of data per second.

A computer's system resource tools are used for communication between hardware and software. The four types of system resources are:

   I/O addresses    Memory addresses.    Interrupt request numbers (IRQ).    Direct memory access (DMA) channels.

DMA channels are used to communicate data between the peripheral device and the system memory. All four system resources rely on certain lines on a bus. Some lines on the bus are used for IRQs, some for addresses (the I/O addresses and the memory address) and some for DMA channels.

A DMA channel enables a device to transfer data without exposing the CPU to a work overload. Without the DMA channels, the CPU copies every piece of data using a peripheral bus from the I/O device. Using a peripheral bus occupies the CPU during the read/write process and does not allow other work to be performed until the operation is completed.

With DMA, the CPU can process other tasks while data transfer is being performed. The transfer of data is first initiated by the CPU. The data block can be transferred to and from memory by the DMAC in three ways.

In burst mode, the system bus is released only after the data transfer is completed. In cycle stealing mode, during the transfer of data between the DMA channel and I/O device, the system bus is relinquished for a few clock cycles so that the CPU can perform other tasks. When the data transfer is complete, the CPU receives an interrupt request from the DMA controller. In transparent mode, the DMAC can take charge of the system bus only when it is not required by the processor.

However, using a DMA controller might cause cache coherency problems. The data stored in RAM accessed by the DMA controller may not be updated with the correct cache data if the CPU is using external memory.

Solutions include flushing cache lines before starting outgoing DMA transfers, or performing a cache invalidation on incoming DMA transfers when external writes are signaled to the cache controller.

Answer:

See explanation

Explanation:

DMA [tex]\to[/tex] Direct Memory Access.

The peripherals of a computer system are always in need to communicate with the main memory; it is the duty of the DMA to allow these peripherals to transfer data to and from the memory.

The first step is that the processor starts the DMA controller, then the peripheral is prepared to send or receive the data; lastly, the DMA sends signal when the peripheral is ready to carry out its operation.

The menu bar display information about your connection process, notifies you when you connect to another website, and identifies the percentage information transferred from the Website server to your browser true or false

Answers

Answer:

false

Explanation:

My teacher quized me on this

As the first step, load the dataset from airline-safety.csv by defining the load_data function below. Have this function return the following (in order):
1. The entire data frame
2. Total number of rows
3. Total number of columns
def load_data():
# YOUR CODE HERE
df, num_rows, num_cols

Answers

Answer:

import pandas as pd

def load_data():

df = pd.read_csv("airline-safety.csv')

num_rows = df.shape[0]

num_cols = df.shape[1]

return df, num_rows, num_cols

Explanation:

Using the pandas python package.

We import the package using the import keyword as pd and we call the pandas methods using the dot(.) notation

pd.read_csv reads the csv data into df variable.

To access the shape of the data which is returned as an array in the format[number of rows, number of columns]

That is ; a data frame with a shape value of [10, 10] has 10 rows and 10 columns.

To access the value of arrays we use square brackets. With values starting with an index of 0 and so on.

The row value is assigned to the variable num_rows and column value assigned to num_cols

Other Questions
Akili has two tests next week. The probability that he will pass the first test, science, is 34 . How he does on that test affects how he will do on his math test. If he passes science, then the probability that he will also pass the math test is 45; otherwise, the probability is only 13 that he will pass the math test. If the probability he passes exactly one test can be expressed as mn for two relatively prime positive integers m and n, what is m n What structure does the poet use to develop the ideas in the poem?A. The last part of each stanza presents a courageous response to the first part, with eachstanza building to the final two triumphant lines of the poem.B. The speaker introduces the darkness he battles in the first stanza and offersmanifestations of that darkness through the remaining stanzas.C. The speaker rhymes alternating lines to develop the conflict between his courage andfear until the fear is overcome at the end.After introducing the idea of the unconquerable soul, the speaker describes situations inwhich he has battled his fears. Independence and Exclusiveness are two topics which are important to probability and often confused. Discuss the difference between two events being independent and two events being mutually exclusive. Use examples to demonstrate the difference. Remember to explain as if you are talking to someone who knows nothing about the topic. What did they ask on FLVS alegebra 1 honors moduel 7 dba Absolute Value Equations Which of these is a factor in this expression?7z4 5 + 10 (y3 + 2)A. -5 + 10 (y + 2)B. (y3 + 2)C. 7z4 5D. 10 (y3 + 2) Which undefined term is used to define an angle?lineplanepointray 20 pts + BRAINLIEST!(From Damon and Pythias)How does Damon advance the plot of this story?A. Damon spends time in jail awaiting Pythias's return, which creates surprise for readers.B. Damon defends Pythias's actions when Dionysius mocks Damon's loyalty to Pythias, leading to the rising action of the story.C. Damon agrees to pledge himself for Pythias's return, which shows Damon's loyalty for his friend, creating tension in the story.D. Damon willingly goes to his execution, hoping his friend does not return, which leads to the climax of the story.( I report spam answers ) An open-pit iron mine has been abandoned for several years. Before they left, the miners filled in the pits with soil that included tailings and other iron containing waste products from the mine's productive years. Which of the following hazards do the pits most likely pose to the surrounding environment?I. Acid mine drainageII. Cyanide leachingIII. Increased carbon emissionsA.) I onlyB.) II onlyC.) III onlyD.) I and III only What is a concrete poem Help answering questions Acid-catalyzed hydrolysis of a nitrile to give a carboxylic acid occurs by initial protonation of the nitrogen atom, followed by nucleophilic addition of water. Draw curved arrows to show the movement of electrons in this step of the reaction mechanism. In order to promote the common ion effect, the concentration of the common ion must first: _____________a. increase b. decrease c. be equal to its equilibrium value d. depends on the equilibrium The advancements in which of the following technologies has most changed the American job market in recent years? A. computer and Internet B. manufacturing C. transportation D. health care Please select the best answer from the choices provided A B C D What represents the inverse of the function f(x) = 4x Find the diameter of the sphere with the volume of 36 pi cubic units Read the ad and answer the questions in English.Appartement CannesTrs beau 2 pices de 50 m2 totalement rnov. Situ dans une belle rsidence au calme! Grand sjour donnant sur une belle terrasse. Cuisine indpendante et chambre donnant sur la terrasse. Salle de bains et WC indpendant. Place de parking au sous-sol. 10 minutes de la mer. deux pas des commerces supermarch, boulangerie, pharmacie. Nous consulter sur le prix.1. How do you know the apartment is in good condition?Answer:2. What stores can you find nearby?Answer:3. Which room(s) leads onto the terrace?Answer:4. How far away is the sea?Enter Text5. Where is there a space for a car?Answer: What industry was a primary driver behind westward American expansion in the early 1800s?MiningThe timber tradeThe fur tradeMapmaking Quadrilateral ABCD will be dilated about the origin by a scale factor of 1/3 and then reflected across the y-axis. What would you do to isolate the variable in the equation below, using only onestep?X + 9 = - 12O Subtract 9 from both sides of the equation.O Add 9 to both sides of the equation.O Subtract 12 from both sides of the equation.O Add 12 to both sides of the equation.