b. [10] What is the output of the following code? def partstring(astr, newstr = '' i...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
b. [10] What is the output of the following code? def partstring(astr, newstr = '' i = 0 while i < num: newstr=newstr+astr[i+2] i=i+1 return (newstr) print (partstring('1:NYCity', 2)) print (partstring('4: Houston', 3)) num): c. [10] Consider the following code def simple (a, b): tempa = 2*a b = 2*b d = tempa+b return d alpha = 11 beta = 7 delta simple (alpha, beta) print (alpha, beta, delta) print(a, b) For the two print statements in the code, state what will be printed. If an error will occur, state that and the reason for the error. i) print (alpha, beta, delta) ii) print (a, b) b. [10] What is the output of the following code? def partstring(astr, newstr = '' i = 0 while i < num: newstr=newstr+astr[i+2] i=i+1 return (newstr) print (partstring('1:NYCity', 2)) print (partstring('4: Houston', 3)) num): c. [10] Consider the following code def simple (a, b): tempa = 2*a b = 2*b d = tempa+b return d alpha = 11 beta = 7 delta simple (alpha, beta) print (alpha, beta, delta) print(a, b) For the two print statements in the code, state what will be printed. If an error will occur, state that and the reason for the error. i) print (alpha, beta, delta) ii) print (a, b)
Expert Answer:
Answer rating: 100% (QA)
Lets analyze the code provided For part b def partstringastr num newstr i 0 while i num newstr newst... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Describe, in detail, how the heapsort algorithm works. [10 marks] Show that the worst-case cost of heapsort is O(n log n). [6 marks] Would it be possible to implement a variant of heapsort based on a...
-
"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...
-
Walmart Stores has run into opposition when it has tried to open stores in certain towns in the United States. Walmarts capital budgeting process has determined that these locations would be...
-
Identify the steps in liquidating a partnership.
-
In what ways are the actions of the lac repressor and trp repressor similar and how are they different with regard to their binding to operator sites, their effects on transcription, and the...
-
Using only the factor formulas given in Table 2.6, derive Equation 7.6 starting with Equation 7.3. TABLE 2.6 Summary of Discrete Compounding Interest Factors. To Find Given Factor Symbol Name P F...
-
Relevant-cost approach to pricing decisions, special order. The following financial data apply to the videotape production plant of the Dill Company for October 2009: Variable manufacturing overhead...
-
Make a Relational Model Table and Define Keys from Entity Relation Diagram Q2: Design the World Music Association Database using given ERD. ORCHESTRA "Orchestra Name City Country Music Director...
-
1: A red photon has a frequency of 4.6*10^14 Hz, how much electrical energy does it carry? ___________________Joules 2: Earth has 2 major Windows that let certain ranges of Electromagnetic frequency...
-
A dry spell in Kenya reduced the water level at the Ndakaini Dam in Kenya by \(75 \%\) of its capacity in April 2017, resulting in water rationing in Nairobi and calls for the public to use water...
-
In Solved Problem 4.5, if the generic bleach increases its strength to equal that of Clorox without changing its price, what bundles will Chris buy if the price of Clorox is \(\$ 3\) or \(\$ 2\) ?...
-
Under the Healthy Start scheme, low-income women in the United Kingdom who are pregnant or have a child under 4 years of age can get free vouchers every week to spend on milk, fruit and vegetables,...
-
On January 1, 2017, the minimum wage in Germany was raised from \(8.50\) per hour to \(8.84\) per hour. Frieda's job pays the minimum wage, and she presently works 8 hours per day, while her utility...
-
Jackson and Ashley Turner (both 45 years old) are married and want to contribute to a Roth IRA for Ashley. In 2019, their AGI is $197,000. Jackson and Ashley each earned half of the income. a. How...
-
Explain two potential issues with requiring and regulating CSR reporting Pepsi Co. is considering issuing its first CSR report to be competitive with their rival, Coca-Cola. Explain in detail 3...
-
What are technical skills At what level are they most important and why?
-
The transfer function of a LTI system is (a) Use the Laplace transform to find the unit-step response s(t) = (h x) (t). (b) Find the response due to the following inputs (i) x 1 (t) = u(t) u(t 1),...
-
The warping effect of the bilinear transformation also affects the phase of the transformed filter. Consider a filter with transfer function G(s) = e 5s . (a) Find the transformed discrete...
-
Consider the following problems related to the modulation and power properties of the Fourier transform. (a) The carrier of an AM system is cos(10t), consider the following message signals i. m(t) =...
-
The global market presents firms with more complex ethical issues than they would experience if operations were limited to one country and one culture. Moral standards vary across cultures. In some...
-
Bhopal is a city in central India with a population, in 1984 , of 800,000 . Because it was, at that time, home to the largest mosque in India, Bhopal was a major railway junction. Its main industries...
-
PricewaterhouseCoopers (or PwC, as it is known), one of the United States' "Big 4" accounting firms, has had a tax practice in Russia since the time that country changed from Communist rule. One of...
Study smarter with the SolutionInn App