Questions
Methane is a clean gaseous fuel used in chemical industries worldwide. 1000 kmol/hr of methane is...


Methane is a clean gaseous fuel used in chemical industries worldwide. 1000 kmol/hr of methane is combusted in a burner to provide heat. The combustion reaction is:
CH4 + O2 à CO2 + H2O
Air is used for combustion and it can be assumed to be composed of 20% oxygen and 80% nitrogen. Nitrogen is considered inert and does not undergo any oxidation reaction.
The inlet pressure for all stream is atmospheric.
Use a conversion reactor in VMGSim simulation package to simulate burner. Assume that the heat loss to surrounding is negligible (very well insulated burner). Pressure drop across the burner is assumed to be 10 kPa. Assume adiabatic conditions with methane conversion of 95%. Follow the simulation guideline (to be provided) and having converged the simulation, export the results to WORD. The followings can be easily determined from the results:
1- Properties of exhaust gases such as average specific heat, enthalpy, entropy, thermal conductivity, viscosity etc.
2- Composition of exhaust gases from the burner in mole% and mass%
3- The flow rate of each component in the exhaust gas in Kg/h
4- Temperature of exhaust gases
5- Pressure of exhaust gases
6- Volumetric flow rate of gases
Now repeat the simulation assuming the you use 50% excess air. You need to increase the mole fraction in the inlet stream to burner. Keeping all other conditions the same, compare the results of the two simulation and answer the following questions in the report. You may add these to the report (exported to WORD).
1- Is the final temperature lower or higher? Why?
2- Is there a change in reaction enthalpy? Explain.
3- Is there any change in specific heats?

In: Chemistry

This is based on LinkedLists. Avneet Pandey, please do not answer this. Both your previous answers...

This is based on LinkedLists. Avneet Pandey, please do not answer this. Both your previous answers were wrong.

Please complete the methods max() and threshold(). I'd greatly appreciate it. There is a type mismatch in my first method and I dont know how to get around it. I've commented on the line with the type mismatch. Please write a correct method in the answer so I can compare it to my wrong method

public class Node {
   public T info;
public Node link;
public Node(T i, Node l) {
   info = i; link = l;
   }
}

class LinkedList> {
  
protected Node head = null;
public LinkedList add(T el) {
head = new Node(el, head);
return this;
}
public void print() {
for(Node node = head; node!=null; node=node.link) {
System.out.print(node.info+" ");
}
System.out.println("");
}
  
public T maxValue() { // Note: Recursive methods not allowed, using new key word not allowed, no iterators allowed
   if (head == null) {
   return null;
   }
   else {
   Node temp = head;
   if (temp.link == null) {
   return temp.info;
   }
   else {
   T max = temp.link; //type mismatch
   if (temp.info.compareTo(max) > 0)
   max = temp.info;
   return max;
   }
}
}
  
public void threshold(T thres) {//Note: Recursive methods not allowed, using new key word not allowed, no iterators allowed

}

public static void main(String args[]) {
  
LinkedList list = new LinkedList();
System.out.println(list.maxValue()); // should be null
list.add(20).add(30).add(10);
System.out.println(list.maxValue()); // should be 30
list.threshold(40);
list.print(); // should print out all elements
list.threshold(30);
list.print(); // should print out 10 20
list.threshold(10);
list.print(); // should print nothing
}
}

In: Computer Science

This is based on LinkedLists. Please complete the methods max() and threshold(). I'd greatly appreciate it....

This is based on LinkedLists. Please complete the methods max() and threshold(). I'd greatly appreciate it. There is a type mismatch in my first method and I dont know how to get around it. I've commented on the line with the type mismatch. Please write a correct method in the answer so I can compare it to my wrong method

public class Node {
   public T info;
public Node link;
public Node(T i, Node l) {
   info = i; link = l;
   }
}

class LinkedList> {
  
protected Node head = null;
public LinkedList add(T el) {
head = new Node(el, head);
return this;
}
public void print() {
for(Node node = head; node!=null; node=node.link) {
System.out.print(node.info+" ");
}
System.out.println("");
}
  
public T maxValue() { // Note: Recursive methods not allowed, using new key word not allowed, no iterators allowed
   if (head == null) {
   return null;
   }
   else {
   Node temp = head;
   if (temp.link == null) {
   return temp.info;
   }
   else {
   T max = temp.link; //type mismatch
   if (temp.info.compareTo(max) > 0)
   max = temp.info;
   return max;
   }
}
}
  
public void threshold(T thres) {//Note: Recursive methods not allowed, using new key word not allowed, no iterators allowed

}

public static void main(String args[]) {
  
LinkedList list = new LinkedList();
System.out.println(list.maxValue()); // should be null
list.add(20).add(30).add(10);
System.out.println(list.maxValue()); // should be 30
list.threshold(40);
list.print(); // should print out all elements
list.threshold(30);
list.print(); // should print out 10 20
list.threshold(10);
list.print(); // should print nothing
}
}

In: Computer Science

This is a java coding String manipulation Question. Let us say I have a String which...

This is a java coding String manipulation Question.

Let us say I have a String which looks something likes this:

String x = "MATH,PHYSICS,CHEMISTRY,CODING"

And then I have another String which looks something like this:

String y = "XXXXMXXXAXXXTXXXXHXXXXXXCXXXXOXXXXDXXXIXXXXNXXXGXXXX"

and another String that looks like this:

String z = "XXXXHXXTXXXXAXXMXXXXXCXXXOXXXDXXXIXXXNXXXG"

I want to take String y and print the words that are found in String x as such:

Math

Coding

and for String z if I want to take it and print the words also found in x as such:

Math

Coding

So basically I want to the program to print the possible words from the letters I have in String y and z.

and only print possible words from my String x.

I want to know how I can do such thing please explain so that I understand what is going on. I have tried replacing the Xs with nothing and then I would have the letters and then I'll use it to check if it has something in String x. but that made me use arrays and also if I replaced Xs with nothing and I had to words in Z or Y then I'll end up with something I can not work with only letters.

I have also thought about making a char array from the resulting String after replacing Xs. and then split String x by ',' and after make a char array of each word and then check if the char array of each word contains the chars of the resulting String after replacing Xs with nothing.

but that also does not work.

I think this is a simple problem that I am over complicating.

Please help and thank you.

In: Computer Science

Write a C program to run on unix to read a text file and print it...

Write a C program to run on unix to read a text file and print it to the display. It should count of the number of words in the file, find the number of occurrences of a substring, and take all the words in the string and sort them (ASCII order). You must use getopt to parse the command line. There is no user input while this program is running.

Usage: mywords [-cs] [-f substring] filename

• The -c flag means to count the number of words in the file. A word would be a series of characters separated by spaces or punctuation. A word could include a hyphen or a single apostrophe.

• The -s option means to print the words in the file sorted by ASCII order.

• The -f option will find the number of occurrences of the given substring.

• You may have any number of the flags included or none of them.

• The order they should be run would be: -s first, -c second, and -f third.

--------------------------------------------------------------------------------

Format of parsing the command line (main method established), rest of functionality needed as explained above:

int value = 0;

int main(int argc, char **argv) {
    extern char *optarg;
    extern int optind;
    int c, err = 0;
    int cflag = 0, sflag = 0, fflag = 0;
    char *substring;

    // usage 
    static char usage[] = "usage: mywords [-cs] [-f substring] filename";  

    while ((c = getopt(argc, argv, "csf:")) != -1)
        switch (c) {
            case 'c':
                cflag = 1;
                break;

            case 's':
                sflag = 1;
                break;

            case 'f':
                fflag = 1;
                substring = optarg;
                break;

            case '?':
                err = 1;
                break;
        }

    if (fflag == 1) {
        printf("%c ", substring);
    }
}

In: Computer Science

Question: Professional Experience #1 Due at the end of Week 1 (not eligible for late policy...

Question: Professional Experience #1 Due at the end of Week 1 (not eligible for late policy unless an appro...

Professional Experience #1

Due at the end of Week 1 (not eligible for late policy unless an approved, documented exception is provided)

*In the workplace, incomplete work is not accepted. The professional experience assignments are designed to help prepare you for that environment. To earn credit, make sure you complete all elements and follow the directions exactly as written. This is a pass/fail assignment, so no partial credit is possible. Assignments that follow directions as written will be scored at a 22. Assignments that are incomplete or do not follow directions will be scored at a zero.

Steps to Complete Professional Experience One:

Step One: Find an article about effective professional communication that was published in the last 18 months.

Step Two: Read the article and develop a 25 to 50-word summary. Summaries shorter than 25 words and longer than 50 will not receive credit.

Step Three: On the top of the page, there is a Link to One Drive – that link will take you to a document entitled "Professional Communication Table." Locate and click on this link.

Step four: The table requests that you provide a hyperlink to the article, your 25-50 word summary, and your name (in the employee section). Fill in the table with the requested information.

In order to receive your points for completing this task you must do the following:

Provide a viable link (not a URL) to the article.

Ensure your summary is no less than 25 and no more than 50 words.

Fill in the "Employee" section with your first and last name.

Copy the webpage link to the article you summarized and submit it to the Professional Experience 1 link in Blackboard.

In: Operations Management

1. Create a PHP page with standard HTML tags. Remember to save the file with the...

1. Create a PHP page with standard HTML tags. Remember to save the file with
the .php extension.
Inside the <body> tag, create a PHP section that will show the text "Hello
World!"
2. For this exercise, echo the phrase "Twinkle, Twinkle little star." Create
two variables, one for the word "Twinkle" and one for the word "star". Echo
the statement tothe browser.
3. PHP includes all the standard arithmetic operators. For this PHP
exercise, you will use them along with variables to print equations to the
browser. In your script, create the following variables:
$x=10;
$y=7;
Write code to print out the following:
10 + 7 = 17
10 - 7 = 3
10 * 7 = 70
10 / 7 = 1.4285714285714
10 % 7 = 3
Use numbers only in the above variable assignments, not in the echo
statements. You will need a third variable as well.
Note: this is intended as a simple, beginning exercise, not using arrays or
loops.
4. Arithmetic-assignment operators perform an arithmetic operation on the
variable at the same time as assigning a new value. For this PHP exercise,
write a script to reproduce the output below. Manipulate only one variable
using no simple arithmetic operators to produce the values given in the
statements.
Hint: In the script each statement ends with "Value is now $variable."
Value is now 8.
Add 2. Value is now 10.
Subtract 4. Value is now 6.
Multiply by 5. Value is now 30.
Divide by 3. Value is now 10.
Increment value by one. Value is now 11.
Decrement value by one. Value is now 10.

In: Computer Science

Word Bank: autonomy beneficence non-malfeasance fidelity justice paternalism ethical relativism feminist theory deontology utilitarianism virtue ethics...

Word Bank:

autonomy beneficence non-malfeasance fidelity
justice paternalism ethical relativism feminist theory
deontology utilitarianism virtue ethics veracity
loyalty duty


Activity: Read each description below, and under each description, type the appropriate term being described from the word bank. Each term may be used more than once if necessary. You will not use all of the terms. (2 pts each / 24 pts total)

Group of answer choices

The patient has started taking antidepressant medication and does not want her children to know. When the children ask the nurse for an update on their mother’s condition, she does not share information about medication.

      [ Choose ]            feminist theory            non-malfeasance            deontology            justice            fidelity            beneficence            Duty            Loyalty            Veracity            paternalism            autonomy            ethical relativism            utilitarianism      

Two employees have stated that they cannot work on holidays. One employee is a single mom with two children. She has no one to watch the children on holidays. The second employee is single with no children but has stated she has no interest in extra pay and is not a happy enough person to work on a holiday. The manager has mandated the single employee to work holidays and has issued a pass to the single mom because she has two children who need her.

      [ Choose ]            feminist theory            non-malfeasance            deontology            justice            fidelity            beneficence            Duty            Loyalty            Veracity            paternalism            autonomy            ethical relativism            utilitarianism      

A surgeon completes an experimental surgery that he believes will help the patient. Unfortunately, the patient dies on the table. The intentions were good, but the outcome was bad.

      [ Choose ]            feminist theory            non-malfeasance            deontology            justice            fidelity            beneficence            Duty            Loyalty            Veracity            paternalism            autonomy            ethical relativism            utilitarianism      

A 46-year-old patient is dying of small cell lung cancer. Although the patient is extremely sick and unable to care for himself, he is still neurologically intact. The patient privately meets with the care team without his family to sign a do not resuscitate order.

      [ Choose ]            feminist theory            non-malfeasance            deontology            justice            fidelity            beneficence            Duty            Loyalty            Veracity            paternalism            autonomy            ethical relativism            utilitarianism      

Two teenage girls have been raped and are pregnant. One girl has an abortion based on the belief that she has been violated and is not morally obligated to keep the baby. The other girl delivers the baby and gives it up for adoption because she believes it is morally wrong to have an abortion.

      [ Choose ]            feminist theory            non-malfeasance            deontology            justice            fidelity            beneficence            Duty            Loyalty            Veracity            paternalism            autonomy            ethical relativism            utilitarianism      

A hospital is conducting a research trial to treat Alzheimer’s disease. The applicants are reviewed by a panel of uninvolved medical personnel in which no knowledge of name, social circumstance, or status is discussed. The information presented is purely diagnostic and lab related to avoid favor and bias.

      [ Choose ]            feminist theory            non-malfeasance            deontology            justice            fidelity            beneficence            Duty            Loyalty            Veracity            paternalism            autonomy            ethical relativism            utilitarianism      

An Amish man needs a liver transplant, due to cirrhosis secondary to heart failure. The medical team tells the patient that he is in liver failure and they have consulted a hospice service to help transfer the patient home. The medical team assumes that transplant is not an option because the patient is Amish.

      [ Choose ]            feminist theory            non-malfeasance            deontology            justice            fidelity            beneficence            Duty            Loyalty            Veracity            paternalism            autonomy            ethical relativism            utilitarianism      

The nurse of a two-year-old patient notes that the toddler is scared to be left alone. The nurse recruits a volunteer to sit with the patient when parents cannot be with the toddler.

      [ Choose ]            feminist theory            non-malfeasance            deontology            justice            fidelity            beneficence            Duty            Loyalty            Veracity            paternalism            autonomy            ethical relativism            utilitarianism      

Within organ donation, there is a strict process of determining who gets what in order to provide healthy organs to the most patients possible.

      [ Choose ]            feminist theory            non-malfeasance            deontology            justice            fidelity            beneficence            Duty            Loyalty            Veracity            paternalism            autonomy            ethical relativism            utilitarianism      

The fellow on call ordered a dose of Lasix (diuretic) at five times the normal dosage and tells the nurse to administer the medication to the patient. The nurse questions the resident. The resident said he already checked the dose and the nurse is wrong. He tells the nurse to administer the medication. The nurse withholds the medication and contacts the attending.

      [ Choose ]            feminist theory            non-malfeasance            deontology            justice            fidelity            beneficence            Duty            Loyalty            Veracity            paternalism            autonomy            ethical relativism            utilitarianism      

All employees are required to work four weekend shifts per month to be fair and provide adequate staffing for patients.

      [ Choose ]            feminist theory            non-malfeasance            deontology            justice            fidelity            beneficence            Duty            Loyalty            Veracity            paternalism            autonomy            ethical relativism            utilitarianism      

A man collapses on the street and goes into cardiac arrest. A passerby immediately stops and does CPR until the EMS team arrives.

In: Nursing

Word Bank: autonomy beneficence non-malfeasance fidelity justice paternalism ethical relativism feminist theory deontology utilitarianism virtue ethics...

Word Bank:

autonomy beneficence non-malfeasance fidelity
justice paternalism ethical relativism feminist theory
deontology utilitarianism virtue ethics veracity
loyalty duty


Activity: Read each description below, and under each description, type the appropriate term being described from the word bank. Each term may be used more than once if necessary. You will not use all of the terms. (2 pts each / 24 pts total)

Group of answer choices

The patient has started taking antidepressant medication and does not want her children to know. When the children ask the nurse for an update on their mother’s condition, she does not share information about medication.

Two employees have stated that they cannot work on holidays. One employee is a single mom with two children. She has no one to watch the children on holidays. The second employee is single with no children but has stated she has no interest in extra pay and is not a happy enough person to work on a holiday. The manager has mandated the single employee to work holidays and has issued a pass to the single mom because she has two children who need her.

A surgeon completes an experimental surgery that he believes will help the patient. Unfortunately, the patient dies on the table. The intentions were good, but the outcome was bad.

  

A 46-year-old patient is dying of small cell lung cancer. Although the patient is extremely sick and unable to care for himself, he is still neurologically intact. The patient privately meets with the care team without his family to sign a do not resuscitate order.

Two teenage girls have been raped and are pregnant. One girl has an abortion based on the belief that she has been violated and is not morally obligated to keep the baby. The other girl delivers the baby and gives it up for adoption because she believes it is morally wrong to have an abortion.

A hospital is conducting a research trial to treat Alzheimer’s disease. The applicants are reviewed by a panel of uninvolved medical personnel in which no knowledge of name, social circumstance, or status is discussed. The information presented is purely diagnostic and lab related to avoid favor and bias.

  

An Amish man needs a liver transplant, due to cirrhosis secondary to heart failure. The medical team tells the patient that he is in liver failure and they have consulted a hospice service to help transfer the patient home. The medical team assumes that transplant is not an option because the patient is Amish.

  

The nurse of a two-year-old patient notes that the toddler is scared to be left alone. The nurse recruits a volunteer to sit with the patient when parents cannot be with the toddler.

Within organ donation, there is a strict process of determining who gets what in order to provide healthy organs to the most patients possible.

  

The fellow on call ordered a dose of Lasix (diuretic) at five times the normal dosage and tells the nurse to administer the medication to the patient. The nurse questions the resident. The resident said he already checked the dose and the nurse is wrong. He tells the nurse to administer the medication. The nurse withholds the medication and contacts the attending.

  

All employees are required to work four weekend shifts per month to be fair and provide adequate staffing for patients.

  

A man collapses on the street and goes into cardiac arrest. A passerby immediately stops and does CPR until the EMS team arrives.

In: Nursing

Problem 1: python For the first problem of this homework, we’re going to try something a...

Problem 1: python

For the first problem of this homework, we’re going to try something a little different. I’ve created the start of a file, which you’ll edit to finish the assignment: count_words_in_the_raven.py

The program has three functions in it.

  1. I’ve written all of break_into_list_of_words()--DO NOT CHANGE THIS ONE. All it does is break the very long poem into a list of individual words. Some of what it's doing will not make much sense to you until we get to the strings chapter, and that's fine--that's part of why I wrote it for you. :)
  2. There’s a main() which you’ll add a little bit to, but it should stay pretty small -- some print statements and some function calls
  3. There’s a definition of a function called count_how_many_words(), which takes two arguments. (Don’t change the arguments.) You’ll write the entire block for this.
    1. Note: My return statement is definitely not what you want; it’s just there so that the program runs when I give it to you. You will want to change what the function returns!

I want you to complete the count_how_many_words() function, and then call it (multiple times) inside main() to find out how many times Poe used the word “Raven” (or “raven”) and how many times he used “Nevermore” (or “nevermore”) inside the poem “The Raven.” You may not use list.count().

Don’t add any global variables or constants (besides the one I’ve declared, which could be moved into main() but would be even uglier there).

Example output (with incorrect numbers):

The word "Raven" (or "raven") appears 42 times in Edgar Allen Poe's "The Raven."

The word "Nevermore" (or "nevermore") appears 48 times in Edgar Allen Poe's "The Raven."

# a constant
THE_RAVEN = '''
Once upon a midnight dreary, while I pondered, weak and weary,
Over many a quaint and curious volume of forgotten lore—
While I nodded, nearly napping, suddenly there came a tapping,
As of some one gently rapping, rapping at my chamber door.
“’Tis some visitor,” I muttered, “tapping at my chamber door—
Only this and nothing more.”

Ah, distinctly I remember it was in the bleak December;
And each separate dying ember wrought its ghost upon the floor.
Eagerly I wished the morrow;—vainly I had sought to borrow
From my books surcease of sorrow—sorrow for the lost Lenore—
For the rare and radiant maiden whom the angels name Lenore—
Nameless here for evermore.

And the silken, sad, uncertain rustling of each purple curtain
Thrilled me—filled me with fantastic terrors never felt before;
So that now, to still the beating of my heart, I stood repeating
“’Tis some visitor entreating entrance at my chamber door—
Some late visitor entreating entrance at my chamber door;—
This it is and nothing more.”

Presently my soul grew stronger; hesitating then no longer,
“Sir,” said I, “or Madam, truly your forgiveness I implore;
But the fact is I was napping, and so gently you came rapping,
And so faintly you came tapping, tapping at my chamber door,
That I scarce was sure I heard you”—here I opened wide the door;—
Darkness there and nothing more.

Deep into that darkness peering, long I stood there wondering, fearing,
Doubting, dreaming dreams no mortal ever dared to dream before;
But the silence was unbroken, and the stillness gave no token,
And the only word there spoken was the whispered word, “Lenore?”
This I whispered, and an echo murmured back the word, “Lenore!”—
Merely this and nothing more.

Back into the chamber turning, all my soul within me burning,
Soon again I heard a tapping somewhat louder than before.
“Surely,” said I, “surely that is something at my window lattice;
Let me see, then, what thereat is, and this mystery explore—
Let my heart be still a moment and this mystery explore;—
’Tis the wind and nothing more!”

Open here I flung the shutter, when, with many a flirt and flutter,
In there stepped a stately Raven of the saintly days of yore;
Not the least obeisance made he; not a minute stopped or stayed he;
But, with mien of lord or lady, perched above my chamber door—
Perched upon a bust of Pallas just above my chamber door—
Perched, and sat, and nothing more.

Then this ebony bird beguiling my sad fancy into smiling,
By the grave and stern decorum of the countenance it wore,
“Though thy crest be shorn and shaven, thou,” I said, “art sure no craven,
Ghastly grim and ancient Raven wandering from the Nightly shore—
Tell me what thy lordly name is on the Night’s Plutonian shore!”
Quoth the Raven “Nevermore.”

Much I marvelled this ungainly fowl to hear discourse so plainly,
Though its answer little meaning—little relevancy bore;
For we cannot help agreeing that no living human being
Ever yet was blessed with seeing bird above his chamber door—
Bird or beast upon the sculptured bust above his chamber door,
With such name as “Nevermore.”

But the Raven, sitting lonely on the placid bust, spoke only
That one word, as if his soul in that one word he did outpour.
Nothing farther then he uttered—not a feather then he fluttered—
Till I scarcely more than muttered “Other friends have flown before—
On the morrow he will leave me, as my Hopes have flown before.”
Then the bird said “Nevermore.”

Startled at the stillness broken by reply so aptly spoken,
“Doubtless,” said I, “what it utters is its only stock and store
Caught from some unhappy master whom unmerciful Disaster
Followed fast and followed faster till his songs one burden bore—
Till the dirges of his Hope that melancholy burden bore
Of ‘Never—nevermore’.”

But the Raven still beguiling all my fancy into smiling,
Straight I wheeled a cushioned seat in front of bird, and bust and door;
Then, upon the velvet sinking, I betook myself to linking
Fancy unto fancy, thinking what this ominous bird of yore—
What this grim, ungainly, ghastly, gaunt, and ominous bird of yore
Meant in croaking “Nevermore.”

This I sat engaged in guessing, but no syllable expressing
To the fowl whose fiery eyes now burned into my bosom’s core;
This and more I sat divining, with my head at ease reclining
On the cushion’s velvet lining that the lamp-light gloated o’er,
But whose velvet-violet lining with the lamp-light gloating o’er,
She shall press, ah, nevermore!

Then, methought, the air grew denser, perfumed from an unseen censer
Swung by Seraphim whose foot-falls tinkled on the tufted floor.
“Wretch,” I cried, “thy God hath lent thee—by these angels he hath sent thee
Respite—respite and nepenthe from thy memories of Lenore;
Quaff, oh quaff this kind nepenthe and forget this lost Lenore!”
Quoth the Raven “Nevermore.”

“Prophet!” said I, “thing of evil!—prophet still, if bird or devil!—
Whether Tempter sent, or whether tempest tossed thee here ashore,
Desolate yet all undaunted, on this desert land enchanted—
On this home by Horror haunted—tell me truly, I implore—
Is there—is there balm in Gilead?—tell me—tell me, I implore!”
Quoth the Raven “Nevermore.”

“Prophet!” said I, “thing of evil!—prophet still, if bird or devil!
By that Heaven that bends above us—by that God we both adore—
Tell this soul with sorrow laden if, within the distant Aidenn,
It shall clasp a sainted maiden whom the angels name Lenore—
Clasp a rare and radiant maiden whom the angels name Lenore.”
Quoth the Raven “Nevermore.”

“Be that word our sign of parting, bird or fiend!” I shrieked, upstarting—
“Get thee back into the tempest and the Night’s Plutonian shore!
Leave no black plume as a token of that lie thy soul hath spoken!
Leave my loneliness unbroken!—quit the bust above my door!
Take thy beak from out my heart, and take thy form from off my door!”
Quoth the Raven “Nevermore.”

And the Raven, never flitting, still is sitting, still is sitting
On the pallid bust of Pallas just above my chamber door;
And his eyes have all the seeming of a demon’s that is dreaming,
And the lamp-light o’er him streaming throws his shadow on the floor;
And my soul from out that shadow that lies floating on the floor
Shall be lifted—nevermore!'''


# this is what quick-and-dirty data cleaning looks like, friends
def break_into_list_of_words(string):
"""takes a long string and returns a list of all of the words in the string"""
# vvv YOU DO NOT HAVE TO CHANGE ANYTHING IN HERE vvv
list_of_words = []
# break by newlines to get a list of lines
list_of_lines = string.split('\n')
# remove the empty lines
while '' in list_of_lines:
list_of_lines.remove('')
# split the line up
for line in list_of_lines:
# we have a few words run together with dashes
# this breaks the line up by dashes (non-ideal, but eh)
maybe_broken_line = line.split('—')
# now we will take the line that might be split, and we'll split again
# but this time on spaces
for a_line in maybe_broken_line:
list_of_words = list_of_words + a_line.split(' ')
# if blank spaces crept in (they did), let's get rid of them
while ' ' in list_of_words:
list_of_words.remove(' ')
while '' in list_of_words:
list_of_words.remove('')
# removing a lot of unnecessary punctuation; gives you more options
# for how to solve this problem
# (you'll get a cleaner way to do this, later in the semester, too)
for index in range(0, len(list_of_words)):
list_of_words[index] = list_of_words[index].strip(";")
list_of_words[index] = list_of_words[index].strip("?")
list_of_words[index] = list_of_words[index].strip(",")
list_of_words[index] = list_of_words[index].strip("!")
# smart quotes will ruin your LIFE
list_of_words[index] = list_of_words[index].strip("“")
list_of_words[index] = list_of_words[index].strip("”")
list_of_words[index] = list_of_words[index].strip("‘")
list_of_words[index] = list_of_words[index].strip(".")
list_of_words[index] = list_of_words[index].strip("’")

# all we have now is a list with words without punctuation
# (secretly, some words still have apostrophes and dashes in 'em)
# (but we don't care)
return list_of_words
# ^^^ YOU DO NOT HAVE TO CHANGE ANYTHING IN HERE ^^^


# this is the function you'll add a lot of logic to
def count_how_many_words(word_list, counting_string):
"""takes in a string and a list and returns the number of times that string occurs in the list"""

return None # this is just here so the program still compiles


def main():
count = 0
words = break_into_list_of_words(THE_RAVEN)
# a reasonable first step, to see what you've got:
# for word in words:
# print(word, end = " ")


if __name__ == "__main__":
main()

In: Computer Science