Questions
This is the question Write a function add(vals1, vals2) that takes as inputs two lists of...

This is the question

Write a function add(vals1, vals2) that takes as inputs two lists of 0 or more numbers, vals1 and vals2, and that uses recursion to construct and return a new list in which each element is the sum of the corresponding elements of vals1 and vals2. You may assume that the two lists have the same length.

For example:

>>> add([1, 2, 3], [3, 5, 8])
result: [4, 7, 11]

Note that:

  • The first element of the result is the sum of the first elements of the original lists (1 + 3 –> 4).
  • The second element of the result is the sum of the second elements of the original lists (2 + 5 –> 7).
  • The third element of the result is the sum of the third elements of the original lists (3 + 8 –> 11)

And this is why i have for the code. But i have not learned del function and im afraid i cant use it.

im only allowed to use

  • arithmetic operators: +, -, *, **, /, //, %
  • boolean operators: <, >, <=, >=, ==, !=
  • comments and docstrings
  • conditional statements: if, elif, else
  • len()
  • logical operators: and, or, not
  • list operations: indexing, slicing, skip-slicing, concatenation, construction
  • print()
  • recursion
  • string operations: indexing, slicing, concatenation, duplication
  • type()

def add(vals1,vals2):
    """return a new list in which each elements is the sum of
        the corresponding elements of val1 and vals2
        input: lists of 0 or more numbers
    """
    if (len(vals1))==0:
        return []
    else:
        x = vals1[0]+vals2[0]
        del vals1[0],vals2[0]
      
      

        return [x]+add(vals1,vals2)

In: Computer Science

Consider a multiple-choice examination with 50 questions. Each question has four possible answers. Assume that a...

Consider a multiple-choice examination with 50 questions. Each question has four possible answers. Assume that a student who has done the homework and attended lectures has a 65% chance of answering any question correctly. (Round your answers to two decimal places.)

(a) A student must answer 44 or more questions correctly to obtain a grade of A. What percentage of the students who have done their homework and attended lectures will obtain a grade of A on this multiple-choice examination? Use the normal approximation of the binomial distribution to answer this question.

(b) A student who answers 34 to 39 questions correctly will receive a grade of C. What percentage of students who have done their homework and attended lectures will obtain a grade of C on this multiple-choice examination? Use the normal approximation of the binomial distribution to answer this question.

(c) A student must answer 30 or more questions correctly to pass the examination. What percentage of the students who have done their homework and attended lectures will pass the examination? Use the normal approximation of the binomial distribution to answer this question.

(d) Assume that a student has not attended class and has not done the homework for the course. Furthermore, assume that the student will simply guess at the answer to each question. What is the probability that this student will answer 30 or more questions correctly and pass the examination? Use the normal approximation of the binomial distribution to answer this question.

In: Math

What are the most significant similarities and differences between ethical decision-making processes prescribed in the APA...

What are the most significant similarities and differences between ethical decision-making processes prescribed in the APA ethics code and those based in a Christian worldview? Explain. How might your research be influenced by these processes? Explain.


In: Psychology

Question 1: Given the infix arithmetic expression as follows: Exp = Z * ((B + C...

Question 1:

Given the infix arithmetic expression as follows:

Exp = Z * ((B + C * D) / S + F)

            Where the values of the variables are:

                        Z = 3, B = 6, C = 2, D = 5, S = 4 , F = 21

            Evaluate the expression using a stack. Shows the logical representation of the evaluation process.

..............................................................................

In: Computer Science

Morris Corporation has the following information on its balance sheets: Cash = $40, accounts receivable =...

Morris Corporation has the following information on its balance sheets: Cash = $40, accounts receivable = $30, inventories = $100, net fixed assets = $500, accounts payable = $20, accruals = $10, short-term debt (matures in less than a year) = $25, long-term debt = $200, and total common equity = $415. Its income statement reports: Sales = $820, costs of goods sold (excluding depreciation) = $450, depreciation = $50, interest expense = $20, and tax rate = 40%. Calculate the following ratios: Net profit margin , operating profit margin , basic earning power ratio and return on total assets and return on common equity

In: Finance

assume the Canadian dollar spot rate is 1.18c$/us$, the swiss spot rate is 1.29CHF/us$ and the...

assume the Canadian dollar spot rate is 1.18c$/us$, the swiss spot rate is 1.29CHF/us$ and the market cross rate is 1.11 chf/c$ a. calculate the implied cross-rate of CHF/c$ b calculate the triangular arbitrage profit, assume you have us$1000 to work with

In: Finance

Continue your observation of the 10-year period selected for Milestones One and Two and research the...

Continue your observation of the 10-year period selected for Milestones One and Two and research the government monetary policies during that time frame. This year are 2005-2015, I need actual data not definitions of the terms specified down below. Specifically, the following critical elements must be addressed:

 Examine the monetary policies in place at the start of your specific time period in relation to their effects on macroeconomic issues. For instance, consider the discount rate set by the Fed, the rates on reserves, open market operations, and so on.

 Analyze new monetary policy actions undertaken by the U.S. government throughout the time period by describing their intended effects, using macroeconomic principles to explain the actions.

 Explain the impact of the new monetary policy actions on individuals and businesses within the economy by integrating the macroeconomic data and principles.

In: Economics

1. On March 1, 20x7, E and F formed a partnership with each contributing the following...

1. On March 1, 20x7, E and F formed a partnership with each contributing the following assets:

E

F

Cash

         20,000

               50,000

Office Equipment

      100,000

               80,000

Building

                  -  

             300,000

Furniture& Fixtures

         30,000

                        -  

The building is subject to a mortgage loan of P80,000, which is to be assumed by the partnership. The partnershipagreement provides that E and F share profits and losses at 30% and 70% respectively. Assuming that thepartners agreed to bring their respective capital in proportion to their P & L ratios, and using F capital as the base.

Compute the capital account balance of F on March 1, 20x7.

Select one:

a. P350,000

b. P510,000

c. P460,000

d. P430,000

2.

On March 1, 20x7, E and F formed a partnership with each contributing the following assets:

E

F

Cash

         20,000

               50,000

Office Equipment

      100,000

               80,000

Building

                  -  

             300,000

Furniture& Fixtures

         30,000

                        -  

The building is subject to a mortgage loan of P80,000, which is to be assumed by the partnership. The partnership agreement provides that E and F share profits and losses at 30% and 70% respectively. Assuming that the partners agreed to bring their respective capital in proportion to their P & L ratios, and using F capital as the base.

How much is the additional cash to be invested by E?

Select one:

a. -0-

b. P200,000

c. P20,000

d. P100,000

3.

SS, TT, UU, and VV, partners to a law firm, shares profits at ratio of 4:3:1:1. On June 30, relevant partners’ accounts follow:

Advances (Dr)

Loans (Cr)

Capital (Cr)

SS

                     -  

       10,000

        50,000

TT

                     -  

       15,000

          80,000

UU

            22,000

                -  

          55,000

VV

            18,000

          75,000

On this day, cash of P60,000 is declared as available for distribution to partnersas profits. Who among the partners will benefit from the P60,000 cash distribution?

Select one:

a. All of the partners

b. TT and VV

c. TT, UU and VV

d. TT only

4.

Brand Constructions began operation in 20x8. Construction activities for the first year is shown below. All contract are with different customers, and any work remaining at December 31, 20x8 is expected to be completed in 20x9. Brand uses the cost-to-cost percentage of completion in accounting for its projects.

Project

Contract price

Billings to date

Collections to date

Actual costs to date

Additional cost to complete

One

560,000

360,000

       340,000

     450,000

         130,000

Two

670,000

220,000

       210,000

     126,000

         504,000

Three

520,000

500,000

       440,000

     330,000

Totals

1,750,000

1,080,000

       990,000

     906,000

         634,000

Calculate the amount of inventory recognized as a current asset in the 20x8 balance sheet.

Select one:

a. P86,000

b. P-0-

c. P24,000

d. P70,000

5.

Partnership of T, U and V and their profit and loss ratios were as follows:

Assets

P 500,000

T, loan

P    20,000

T, capital (30%)

140,000

U, capital (30%)

120,000

V, capital (40%)

180,000

Total equities

460,000

T decided to retire from the partnership and by mutual agreement, the assets were adjusted to their current fairvalue of P625,000. The partnership paid P200,000 cash for T’s equity in the partnership, exclusive of the loanwhich was repaid in full.

The capital balances of U and V, respectively, after T’s retirement from the partnership was:

Select one:

a. P146,250 and P218,750

b. P147,857 and P217,143

c. P139,286 and P205,714

d. P94,286 and P145,714

6.

On June 1, A and B pooled their assets to form a partnership, with the firm to take over their business assets and assumethe liabilities. Partners’ capitals are to be based on net assets transferred after the following adjustments:

  1. B’s inventory is to be increased by P5,000.
  2. An allowance for doubtful accounts of P2,800 and P2,500 are to be set up on the books of A and B, respectively.
  3. Accounts payable of P7,000 is to be recognized on the books of A.

The individual trial balances on June 1, before adjustments follow:

A, capital

B, capital

Assets

P   90,000

P   45,000

Liabilities

         10,000

5,000

Capital

         80,000

40,000

What is the capital balance of B after adjustments?

Select one:

a. P45,200

b. P35,500

c. P42,000

d. P42,500

In: Accounting

Junk bonds: JC Penney has a CCC- rated corporate bond outstanding. There are 4 years remaining...

Junk bonds: JC Penney has a CCC- rated corporate bond outstanding. There are 4 years remaining to maturity. The bond has a 5.75% coupon and closed at 85.372. Find the bond’s yield to maturity.

In: Finance

Is cosmetic surgery a harmful social practice? Should it be banned?

Is cosmetic surgery a harmful social practice? Should it be banned?

In: Psychology

6. The worst case scenario in the quick sort occurs when the array is partitioned to...

6. The worst case scenario in the quick sort occurs when the array is partitioned to two equal sized subarray every time that a recursive call takes place.

True

False

7.Suppose that we want to sort an array of n elements, where each element is a string of at most 1000 characters. What is the time requirement for applying radix sort to sort this array?

O(n2)

O(1000n)

O(l000logn)

O(nlogn)

8.Suppose we want to sort the following array of integers using radix sort:

a=[14 682 120 50 327]

What are the intermediate steps?

pass1: 14 682 120 50 327

pass2: 14 50 120 682 327

pass3: 14 50 120 327 682

pass1: 14 682 120 50 327

pass2: 14 120 682 50 327

pass3: 14 50 120 682 327

pass4:14 50 120 327 680

pass1: 14 50 120 327 682

pass1: 120 50 682 14 327

pass2: 14 120 327 50 682

pass3: 14 50 120 327 682

9.What are the intermediate steps for patitioning the folloiwng array when taking the pivot as the median of the first,middle, and last items (suppse that the threshold for calling insertion sort is an array of size 2)

a= [12 5 8 6 9 11 10 ]

[6 5 8 10 9 11 12]

[6 5 8 11 9 10 12]

[6 5 8 9 11 10 12]

[6 5 8 9 10 11 12]

[12 5 8 11 9 6 10 ]

[5 12 8 11 9 6 10]

[5 6 12 8 11 9 10]

[12 11 8 6 9 5 10 ]

[5 11 8 6 9 12 10]

[12 5 8 6 11 9 10 ]

[6 5 8 12 11 9 10]

[6 5 8 9 11 12 10]

10.Although radix sort has the best time efficiency among other sorting algorithm it is not always applicable because it imposes some restrictions on the type of the data that can be sorted.

True

False

In: Computer Science

How is a combination lock with two numbers (0 and 1) similar to bit encryption, given...

How is a combination lock with two numbers (0 and 1) similar to bit encryption, given we had the ability to add as many wheels as we wanted?

In: Computer Science

Bill plans to open a self-serve grooming center in a storefront. The grooming equipment will cost...

Bill plans to open a self-serve grooming center in a storefront. The grooming equipment will cost $390,000, to be paid immediately. Bill expects aftertax cash inflows of $85,000 annually for six years, after which he plans to scrap the equipment and retire to the beaches of Nevis. The first cash inflow occurs at the end of the first year. Assume the required return is 10 percent.

  

What is the project’s profitability index (PI)? (Do not round intermediate calculations. Round your answer to 3 decimal places, e.g., 32.161.)

In: Finance

Round Hammer is comparing two different capital structures: An all-equity plan (Plan I) and a levered...

Round Hammer is comparing two different capital structures: An all-equity plan (Plan I) and a levered plan (Plan II). Under Plan I, the company would have 170,000 shares of stock outstanding. Under Plan II, there would be 120,000 shares of stock outstanding and $1.45 million in debt outstanding. The interest rate on the debt is 8 percent and there are no taxes.

  

a.

Use M&M Proposition I to find the price per share. (Do not round intermediate calculations and round your answer to 2 decimal places, e.g., 32.16.)

b. What is the value of the firm under each of the two proposed plans? (Do not round intermediate calculations and round your answers to the nearest whole dollar amount, e.g., 32.)

In: Finance

Management topic discuss in details the techniques used by different corporations for promoting their sales. in...

Management topic
discuss in details the techniques used by different corporations for promoting their sales. in 300 or 400 words .

In: Operations Management