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

  Compute the amount alan would withdraw assuming investment

Compute the amount Alan would withdraw assuming the investment earns interest compounded annually

  The cost of the annuity was 46800 and cecil was expected to

cecil c. seymour is a 646-year-old widower. he had income for 2013 as followspension from former employer 39850interest

  What is the probability the person

What is the probability the person is 20 to 24 years old? What is the probability the person is 20 to 34 years old?

  Ability to predict the future

A person claims to be able to predict the outcome of flipping a coin. This person is correct 16/25 times. Compute the 95% confidence interval on the proportion of times this person can predict coin flips correctly. What Conclusion can you draw abo..

  Corporation uses the weighted-average method in its process

corporation uses the weighted-average method in its process costing. the following data concern the companys assembly

  Compute the materials-labor and overhead variances

The predetermined manufacturing overhead rate is $10 perdirect labor hour ($15.00 / 15). Compute all of the materials, labor and overhead variances

  Calculate the accounts receivable turnover ratio for 2010

calculate the true cash balance. lo 1. use the following information to calculate the true reconciled cash balancebank

  Ngata corp issued 17-year bonds 2 years ago at a coupon

ngata corp. issued 17-year bonds 2 years ago at a coupon rate of 9.8 percent. the bonds make semiannual payments. if

  Assume that you are the owner of a small neighborhood

Assume that you are the owner of a small neighborhood bakery serving hundreds of customers in your area. Identify the kinds of customer information you would like your firm CRM system to capture.

  At the end of the fiscal year larsen realty corporation

larsen realty corporation purchased a tract of unimproved land for 51000. this land was improved and subdivided into

  Prepare the correcting je that you would propose

On February 1, 2010, Katz corp. purchased a small lot and unusable building for $12,000, including back taxes of $1,000. On March 1, 2010, the lot was cleared, paved, and fenced to provide additional parking for employees.

  What types of unethical behaviors

What types of unethical behaviors should we expect to see from our Clients? Also, how do we interpret "honest" mistakes from intentional fraud?

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