Assume that you are writing a test driver for a function called count_diffs (), which accepts...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Assume that you are writing a test driver for a function called count_diffs (), which accepts two strings S1 and 52 as parameters. The function is supposed to return the count of how many letters are different between the two strings. For example, the number of differences between "aaaaa" and "aagag" is 2, because there are two places where the strings are not exactly the same. Assume also that two variables called test_valuel and test_value2 have already been initialized with values of "atgcaacg" and "atacagcc"... Write a block of code to test the count_diffs () function using test_valuel and test_value2 together as the test case. The code should print out "error found" if the test detects an error, and otherwise prints nothing at all. Additional Notes: . test_value2 and test_value1 should not be modified Regarding your code's standard output, CodeLab will check for case errors but will ignore whitespace (tabs, spaces, newlines) altogether. Assume that you are writing a test driver for a function called count_diffs (), which accepts two strings S1 and 52 as parameters. The function is supposed to return the count of how many letters are different between the two strings. For example, the number of differences between "aaaaa" and "aagag" is 2, because there are two places where the strings are not exactly the same. Assume also that two variables called test_valuel and test_value2 have already been initialized with values of "atgcaacg" and "atacagcc"... Write a block of code to test the count_diffs () function using test_valuel and test_value2 together as the test case. The code should print out "error found" if the test detects an error, and otherwise prints nothing at all. Additional Notes: . test_value2 and test_value1 should not be modified Regarding your code's standard output, CodeLab will check for case errors but will ignore whitespace (tabs, spaces, newlines) altogether.
Expert Answer:
Answer rating: 100% (QA)
Below is a Python script that demonstrates how you can test this function using the giv... View the full answer
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
write a job description for Bill Ryan's job. What other information would you need to write a better job description? Remember, this is a job description, not a help wanted ad. Please do your own...
-
The final project for this course is the creation of a memorandum with an appendix of supporting IRS forms and schedules . Working as an accounting associate in a financial organization requires the...
-
Before you begin this assignment, be sure you have read the UMUC Family Clinic Case Study below and your Week 1 and Week2 syllabus readings, which discuss EHR functionality and Process...
-
In the game of chess, if a board position is repeated three times with the same side to move, the side to move can declare a draw. Describe how you could test this condition using a computer program.
-
It is known that on clear nights a thin layer of water on the ground will freeze before the air temperature drops below 0C. Consider such a layer of water on a clear night for which the effective sky...
-
Lemma 2.9 says that if M and N are invariant complements then t has a representation in the given block form (with respect to the same ending as starting basis, of course). Does the implication...
-
The magnetic field magnitude is \(4.0 \mathrm{mT}\) at a position \(6.2 \mathrm{~mm}\) radially away from a long current-carrying wire. Calculate \((a)\) the current in the wire and \((b)\) the...
-
The Wasatch Construction Company entered into a $4,500,000 contract in early 2011 to construct a multipurpose recreational facility for the city of Helper. Construction time extended over a 2-year...
-
1. 120g of an organic compound that contains only carbon and hydrogen gives 330g of CO2 and 270g of water on complete combustion. The percentage of carbon and hydrogen, respectively are (a) 25 and 75...
-
Gulf Uniform Supply, Inc. (GUS), a merchandising business, is organized as a corporation. The business sells a complete line of uniforms for a variety of businesses and organizations, including...
-
What does Internal Revenue Code Section 7525 privileged communication apply to?
-
The trial balance extracted from the books of Tailor Times Ltd at 31 December 2012 was as follows: You are given the following additional information: (i) The authorised and issued share capital is...
-
The trial balance of Happy Bookkeeper Ltd, as produced by its bookkeeper, includes the following items: You have been given the following information: (i) The sales ledger debit balances total...
-
If we pass a pointer to an array as a function parameter, must we use pointer notation to access the elements of the array?
-
Flyer Ltd started in business on 1 April 2011. Its issued share capital was 200,000 ordinary shares of 1 each and 100,000 5 per cent preference shares of 1 each. The following information is...
-
Explain what you understand by the accounting term capital gearing, showing clearly the benefits of, and the potential problems associated with high gearing. (Scottish Qualifications Authority)
-
Discuss the utility and applicability of Hesss Law inthe laboratory environment. Here are some suggestions of topics on which to elaborate uponin your explanations: An explanation of the similarities...
-
Explain the operation of the dividends received deduction.
-
Write a program that creates two instances of the generic class LinkedList given in Listing 12.12. The first instance is stadiumNames and will hold items of type String. The second instance is...
-
Suppose we can buy a chocolate bar from the vending machine for $1 each. Inside every chocolate bar is a coupon. We can redeem six coupons for one chocolate bar from the machine. This means that once...
-
Repeat the previous exercise, but define an enumeration and use it within the switch statement. Previous exercise Imagine a program that displays a menu of five possible choices, lettered a through...
-
Using a financial calculator, solve for the unknowns in each of the following situations. a. On June 1, 2024, Holly Golightly purchases lakefront property from her neighbor, George Peppard, and...
-
Stan rented an office building to Clay for \($3,000\) per month. On December 29, 2022, Stan received a deposit of \($4,000\) in addition to the first and last months rent. Occupancy began on January...
-
In 2017, Harry and Mary purchased Series EE bonds, and in 2023 redeemed the bonds, receiving \($500\) of interest and \($1,500\) of principal. Their income from other sources totaled \($30,000.\)...
Study smarter with the SolutionInn App