UESTION 31 ot yet answered arked out of 1.00 A perfect pair of integers are those...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
UESTION 31 ot yet answered arked out of 1.00 A perfect pair of integers are those where the sum of the double of each multiple of the first number except the numbers themselves, is a multiple of 10. For example, consider the integers 2 and 8, where the multiples of 2 between 2 and 8 are 2, 4, 6, and 8. The double of each multiple excluding the numbers themselves are 8 and 12. - 81220 which is a multiple of 10 Therefore the integers 2 and 8 (in that order) is a perfect pair as the sum of the double of each multiple of the first number except the numbers themselves, is a multiple of 10. You will write some code that will classify a pair of integers as "Perfect Pair" or Not Perfect Pair". For this question, you do not need to be concerned with error conditions unless specifically asked to do so. ANSWER THE FOLLOWING FOUR (4) QUESTIONS a., b., c., and d.: [ENTER THE ANSWERS IN THE BOX PROVIDED AFTER THE QUESTIONS] a. Write a function called isMultiple that accepts two positive integers. If the first integer divides the second integer with a remainder of 0, then isMultiple returns True, otherwise it returns False. [2 marks] e.g. >>> isMultiple (28,7) False >>> isMultiple (64,256) True b. Write a function called multipleList that accepts two integers. It steps through the full range of numbers between the first integer and second integer inclusive and returns the integer's multiples as a list. It must use the function isMultiple that was written in part a. above. e.g. >>> multipleList (64,256) [3 marks] C. [64, 128, 256] Write a function called doubleSumList that accepts a list of positive integers and [4 marks] d. e.g. >>> doubleSumList ([1, 2, 3, 4, 5]) 30 returns the sum of double each number. Write a procedure called perfectOrNot that accepts two positive integers and prints whether the integers are a perfect pair (sum of the double of each multiple except the numbers themselves, is a multiple of 10). It must use the functions multipleList and doubleSumList that were written in parts b. and c. above. e.g. >>> perfectOrNot (2, 14) Perfect Pair >>> perfectOrNot (2, 10) Not Perfect Pair [6 marks] [ENTER ANSWERS HERE] [The answer area for each question may be expanded as desired.] a. b. d. UESTION 31 ot yet answered arked out of 1.00 A perfect pair of integers are those where the sum of the double of each multiple of the first number except the numbers themselves, is a multiple of 10. For example, consider the integers 2 and 8, where the multiples of 2 between 2 and 8 are 2, 4, 6, and 8. The double of each multiple excluding the numbers themselves are 8 and 12. - 81220 which is a multiple of 10 Therefore the integers 2 and 8 (in that order) is a perfect pair as the sum of the double of each multiple of the first number except the numbers themselves, is a multiple of 10. You will write some code that will classify a pair of integers as "Perfect Pair" or Not Perfect Pair". For this question, you do not need to be concerned with error conditions unless specifically asked to do so. ANSWER THE FOLLOWING FOUR (4) QUESTIONS a., b., c., and d.: [ENTER THE ANSWERS IN THE BOX PROVIDED AFTER THE QUESTIONS] a. Write a function called isMultiple that accepts two positive integers. If the first integer divides the second integer with a remainder of 0, then isMultiple returns True, otherwise it returns False. [2 marks] e.g. >>> isMultiple (28,7) False >>> isMultiple (64,256) True b. Write a function called multipleList that accepts two integers. It steps through the full range of numbers between the first integer and second integer inclusive and returns the integer's multiples as a list. It must use the function isMultiple that was written in part a. above. e.g. >>> multipleList (64,256) [3 marks] C. [64, 128, 256] Write a function called doubleSumList that accepts a list of positive integers and [4 marks] d. e.g. >>> doubleSumList ([1, 2, 3, 4, 5]) 30 returns the sum of double each number. Write a procedure called perfectOrNot that accepts two positive integers and prints whether the integers are a perfect pair (sum of the double of each multiple except the numbers themselves, is a multiple of 10). It must use the functions multipleList and doubleSumList that were written in parts b. and c. above. e.g. >>> perfectOrNot (2, 14) Perfect Pair >>> perfectOrNot (2, 10) Not Perfect Pair [6 marks] [ENTER ANSWERS HERE] [The answer area for each question may be expanded as desired.] a. b. d.
Expert Answer:
Related Book For
Posted Date:
Students also viewed these algorithms questions
-
Portray in words what transforms you would have to make to your execution to some degree (a) to accomplish this and remark on the benefits and detriments of this thought.You are approached to compose...
-
"internet radios" for streaming audio, and personal video recorders and players. Describe design and evaluation processes that could be used by a start-up company to improve the usability of such...
-
The inequality describes the range of monthly average temperatures T in degrees Fahrenheit at a certain location. (a) Solve the inequality. (b) If the high and low monthly average temperatures...
-
Think about the most recent technological developments. What are the likely implications of these developments for employers during the next 10 years? For employees?
-
Which of the following items would most likely be classified as a financing activity? A. Issuance of debt. B. Payment of income taxes. C. Investments in the stock of a supplier.
-
Draw an energy diagram for the process of charging a capacitor with a dielectric as shown in Figure \(26.15 b\) for the following systems: \((a)\) battery, capacitor, and dielectric; \((b)\)...
-
Consider Joules apparatus described in Figure 20.1. The mass of each of the two blocks is 1.50 kg, and the insulated tank is filled with 200 g of water. What is the increase in the temperature of the...
-
Magic Mountain retires its 9% bonds for $128,000 before their scheduled maturity. At the time, the bonds have a face value of 126,000 and a carrying value of $117,000. Record the early retirement of...
-
What is an arrest?
-
Suppose that num is an int variable. Consider the following C++ code: cin >> num; (num > 0) switch a. b. { case 0: else C. d. num=static_cast (pow (num, 3.0)); case 2: break; } (num) num++num; case...
-
The Bayou Company makes crab pots. During the current month, direct materials costing $126,000 were put into production. Direct labor of $78,000 was incurred and overhead equaled $84,000. Selling and...
-
Can integrity be objectively measured or assessed, considering its multifaceted nature and subjective interpretations?
-
The following data were reported in the shareholders equity section of the Zhang Companys comparative balance sheets for the years ended December 31: ($ in millions) 2024 2023 Common stock, $ 1 par...
-
Rewrite the Following Sentences to Make Them More Readable by Eliminating Jargon and Redundant Expressions The lease is enclosed herewith. Once you submit your request, it will thereafter be...
-
1. In the scenario Guess Whos Coming to Dinner, what is demonstrated by the number of meals given to each person? A. Hunger is a problem caused by poor farming techniques. B. Having a democratic...
-
Respond to the ethical judgments required based on the following scenarios. Scenario 1. Assume you have collected a sample using MUS and that you have evaluated that sample to calculate a total...
-
The von Neumann entropy satisfies a further inequality among three systems called strong subadditivity. \({ }^{20}\) As with subadditivity, strong subadditivity is only a property of the von Neumann...
-
In Example 12.1, we introduced the Hong-Ou-Mandel interferometer and presented an analysis of thinking about the photons produced by the laser as classical electromagnetic waves. In this exercise, we...
-
The quaternions are three quantities i, j, and k such that, along with the real number 1, they form the basis of a four-dimensional space over the real numbers. The objects i, j, and k have...
Study smarter with the SolutionInn App