Non-recursive function vowels

Assignment Help Accounting Basics
Reference no: EM13916989

1a. Write a non-recursive function vowels() that accepts a character string and counts and returns the number of vowels (aeiou) in the string.

1b. Write a recursive function rvowels() that accepts a character string and counts and returns the number of vowels (aeiou) in the string. This solution should not include any loops. A global variable for the counter is acceptable. (Hint: one possible solution is to "chop" the string down until you are left with a single character.)

1c. Using the test string ‘this is a test to see if my program can accurately count the vowels' and the time operation described in the book on page 371 in the function timing, time the non-recursive solution and the recursive solution. Does this test provide any useable proof? Explain.

Place both your functions into one file. Dropbox your Word document showing all code and output, along with your Python file. In the Word document, include your answer to the above question: Does this test provide any useable proof? Explain.

2. Write a recursive function which accepts a string and its length and determines if the string is a palindrome. A palindrome is a string that reads the same frontwards and backwards. Hint: compare the first character with the last character. Equal or not? Go from there.

Reference no: EM13916989

Questions Cloud

Find the conditional probability : A person born in 1964 is equally likely to live for any (not necessarily integer) number of years between 1 and 100. find the conditional probability P(T >80|T>50)
Determine the synchronous reactance of the machine : From the OC and SC tests determine the synchronous reactance of the machine at different values of the field and the machine SCR.
Two trains of equal length are running on parallel lines : Two trains of equal length are running on parallel lines in the same direction at 46 km/hr and 36 km/hr. If the faster train passes the slower train in 36 seconds,what is the length of each train?
Candidates online network for background information : Contacting people in a job candidate's online network for background information ________
Non-recursive function vowels : Write a recursive function rvowels() that accepts a character string and counts and returns the number of vowels (aeiou) in the string. This solution should not include any loops. A global variable for the counter is acceptable. (Hint: one possibl..
A jogger is running at 9 kmph alongside a railway track : A jogger is running at 9 kmph alongside a railway track in 240 meters ahead of the engine of a 120 meters long train . The train is running at 45 kmph in the same direction. how much time does it take for the train to pass the jogger?
What is the probability that the battery will fail : Tests on a certain battery have determined that the mean (average) time until failure is 40 hours. Assume that the time T until failure of the battery is exponentially distributed. What is the probability that the battery will fail within 40 hours
What time will it take to pass a platform of 140 m long : A train 360 m long runs with a speed of 45 km/hr. What time will it take to pass a platform of 140 m long?
Cryptographic basis of the enigma machine : A 2,000-bit message is used to generate a 256-bit hash. One the average, how many other messages could be expected to generate the same hash value? What does this tell us about the length of a hash as compared to the length of the message?

Reviews

Write a Review

Accounting Basics Questions & Answers

  How much control does fed have over this longer real rate

Hubbard argues that the Fed can control the Fed funds rate, but the interest rate that is important for the economy is a longer-term real rate of interest.   How much control does the Fed have over this longer real rate?

  Coures:- fundamental accounting principles

Coures:- Fundamental Accounting Principles: - Explain the goals and uses of special journals.

  Accounting problems

Accounting problems,  Draw a detailed timeline incorporating the dividends, calculate    the exact Payback Period  b)   the discounted Payback Period. the IRR,  the NPV, the Profitability Index.

  Write a report on internal controls

Write a report on Internal Controls

  Prepare the bank reconciliation for company

Prepare the bank reconciliation for company.

  Cost-benefit analysis

Create a cost-benefit analysis to evaluate the project

  Theory of interest

Theory of Interest: NPV, IRR, Nominal and Real, Amortization, Sinking Fund, TWRR, DWRR

  Liquidity and profitability

Distinguish between liquidity and profitability.

  What is the expected risk premium on the portfolio

Your Corp, Inc. has a corporate tax rate of 35%. Please calculate their after tax cost of debt expressed as a percentage. Your Corp, Inc. has several outstanding bond issues all of which require semiannual interest payments.

  Simple interest and compound interest

Simple Interest, Compound interest, discount rate, force of interest, AV, PV

  Capm and venture capital

CAPM and Venture Capital

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd