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

  Thomas contract specifies that it will receive a flat fee

thomas consultants provided bran construction with assistance in implementing various cost-savings initiatives. thomas

  January 2008 a young artist called michelangelo signed a

january 2008 a young artist called michelangelo signed a contract with a charity named art angels which supports young

  What is the income statement

What is the income statement?

  Assume the fair value of the bonds on december 31 2014 had

federal semiconductors issued 11 bonds dated january 1 with a face amount of 880 million on january 1 2013. the bonds

  The fifo cost flow assumption

Uncle Butch's Hunting Supply Shop reports the following information related to inventory:

  Mail service purchased equipment for 2500 martin paid 500

mail service purchased equipment for 2500. martin paid 500 in a cash and signed a note for the balance. martin debited

  A home-owner is trying to determine which of three devices

a home-owner is trying to determine which of three devices to purchase to treat water at the tap. research has shown

  Let us say you are planning to start a new business you

let us say you are planning to start a new business. you expect to have losses for the first two years and then achieve

  In addition to those accounts listed on the trial balance

in addition to those accounts listed on the trial balance the chart of accounts for neosho river resort inc. also

  The nfpo financial statements for the year ended

Prepare journal entries to record the transactions in E12- 1 For each of the following transactions, identify the net asset classification (unrestricted, temporarily restricted, permanently restricted) that is affected in the NFPO financial statem..

  Conversion of the preferred stock to the common stock

The market value of the common stock at the date of the conversion was $30 per share. What total amount should be credited to additional paid-in capital from common stock as a result of the conversion of the preferred stock into common stock?

  What is the expected incremental cost associated

Reef Office Supplies is interested in estimating the cost involved in hiring new employees. The following information is available regarding the costs of operating the Human Resource department at Reef Office Supplies in May when there were 60 new..

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