Need help with your Discussion

Get a timely done, PLAGIARISM-FREE paper
from our highly-qualified writers!

glass
pen
clip
papers
heaphones

University Wisconsin Milwaukee Returns the Number Python Problem Exercise

University Wisconsin Milwaukee Returns the Number Python Problem Exercise

University Wisconsin Milwaukee Returns the Number Python Problem Exercise

Question Description

I’m working on a Computer Science multi-part question and need an explanation to help me understand better.

Problem 2. Introduction

Here we will be counting e’s in text files, capitalized and uncapitalized, and accented and unaccented.

Your code in 2(b) must include a function called

    count_letter_e(filename, ignore_accents, ignore_case)

That is, count_letter_e:

  • takes a filename, such as "pg1342.txt", as input, and
  • returns the number of e‘s as output.
  • includes two optional arguments, ignore_accents and ignore_case.
    • When ignore_accents = True, your function should count accented characters such as é, ê, and è as the same as e.
    • When ignore_case=True, your function should treat uppercase and lowercase e as the same letter.
    • The function count_letter_e() should return a single number, the total number of all characters that are being treated as equivalent to e.
    • Create other functions as necessary to organize your work.
    • Include comments which explain the purpose and arguments of each function you create.
    • The files are encoded as utf-8. When reading the files, you may have to specify the encoding.

Problem 2(a). Design a Test Suite

Design a test suite (which will be in this case a set of input text) of at least four sentences that will allow you to quickly verify that all four optional argument possibilities are implemented correctly. Make sure that your test suite contains at least one of each of the 8 possible e’s (e, é, ê, è, E, É, Ê, È).

Save your test suite as a set of text files (1 sentence per text file) for use in your count_letter_e() function, and also include each test sentence in a different markdown cell below. For each sentence, count each type of e by hand and report (in the markdown cell) what the output should be for the four possible combinations of true and false for ignore_case and ignore_accents.

*Note that you can complete this portion before you have written a single line of code for your function count_letter_e().

1

Test sentence 1:

2

  * Sentence: 

3

  * Count with `ignore_case=True, ignore_accents=True`:

4

  * Count with `ignore_case=True, ignore_accents=False`:

5

  * Count with `ignore_case=False, ignore_accents=True`:

6

  * Count with `ignore_case=False, ignore_accents=False`:


1

Test sentence 2:

2


3

Sentence:

4

Count with ignore_case=True, ignore_accents=True:

5

Count with ignore_case=True, ignore_accents=False:

6

Count with ignore_case=False, ignore_accents=True:

7

Count with ignore_case=False, ignore_accents=False:

Test sentence 3:

Test sentence 4:

Describe how you can use your four test sentences to detect problems in your implementation of count_letter_e(). Why do you need four sentences, and not just one, or as many as 16?

Problem 2(b). Create and Test Your Code

Create the functions described in Problem 2 Introduction, and apply them to your test suite from 2(a). Do not use Python packages or code directly copied from online resources. Write your own functions from first principles.

Print the results of applying the four combinations of optional arguments of your count_letter_e() function to your test suite. Verify that the output is correct. (If it isn’t, modify your code until your function works correctly on your test suite.)

In [ ]:


1


Problem 2(c). Apply Your Code

Apply your code from 2(b) to the two provided .txt files for Pride and Prejudice and L’Enlèvement de la redoute. For each file, print the output of all four combinations of the boolean arguments to count_letter_e.

In [ ]:

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Order Solution Now

Our Service Charter


1. Professional & Expert Writers: Eminence Papers only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Eminence Papers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Eminence Papers are known for the timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Eminence Papers, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.

We Can Write It for You! Enjoy 20% OFF on This Order. Use Code SAVE20

Stuck with your Assignment?

Enjoy 20% OFF Today
Use code SAVE20