Write a function def countVowel (word) that returns a count of all vowels in the string...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a function def countVowel (word) that returns a count of all vowels in the string word. Vowels are the letters a, e, i, o, and u and their uppercase variations, A, E, I, O, and U. • Create a count variable • Use a for loop to check each character (ch) in the string (word) • Inside the for loop, use an if statement to test if the character is in 'AEIOU' (you might want to change each character to .upper () here. o If there is a vowel, increase the count . Return the count from the function Ex: If word is: Wonderful then the return value from the function is: 3 because there is an 'o', 'e', and 'u'. Ex: If word is: Eventually then the return value from the function is: 4 because there are 'e', 'u', and 'a'. You only need to write the function. Unit tests will access your function. 453038.3110466.qx3zqy7 LAB ACTIVITY 5.3.1: LAB: Function to count vowels 0/10 Write a function def countVowel (word) that returns a count of all vowels in the string word. Vowels are the letters a, e, i, o, and u and their uppercase variations, A, E, I, O, and U. • Create a count variable • Use a for loop to check each character (ch) in the string (word) • Inside the for loop, use an if statement to test if the character is in 'AEIOU' (you might want to change each character to .upper () here. o If there is a vowel, increase the count . Return the count from the function Ex: If word is: Wonderful then the return value from the function is: 3 because there is an 'o', 'e', and 'u'. Ex: If word is: Eventually then the return value from the function is: 4 because there are 'e', 'u', and 'a'. You only need to write the function. Unit tests will access your function. 453038.3110466.qx3zqy7 LAB ACTIVITY 5.3.1: LAB: Function to count vowels 0/10
Expert Answer:
Answer rating: 100% (QA)
Certainly heres a Python function that counts the vowels in a given word ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Barriers to Entering Global Markets Most services are inseparable and require production and consumption to occur almost simultaneously; thus, exporting is not a viable entry method for them....
-
Write a method public static int countVowels(String str) that returns a count of all vowels in the string str. Vowels are the letters a, e, i, o, and u, and their uppercase variants. Use a helper...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Find the lengths of the curves. The curve r = a sin 2 (/2), 0 , a > 0
-
Two cylinders are connected by a rope that passes over two fixed rods as shown. Knowing that the coefficient of static friction between the rope and the rods is 0.40, determine the range of values of...
-
A bead with a mass of 0.25 kg is released from rest at A and slides down and around the fixed smooth wire. Determine the force N between the wire and the bead as it passes point B. A 0.6 m B 45 0.15 m
-
McDonald and Ayers [1978] present data from an early study that examined the possible link between air pollution and mortality. Table B. 15 summarizes the data. The response MORT is the total...
-
Calvin uses fraud to induce Maria to promise to pay money in return for goods he has delivered to her. Has a contract been formed? If so, what kind? What are the rights of Calvin and Maria?
-
How do these parenting styles differ? How might each parenting style affect socioemotional development? What is an example of a behavior exhibited by both the parent and the child associated with...
-
Accounting ( Reference - X White Glove Cleaning Post-Closing Trial Balance November 30, 2018 Balance Debit Credit 94,700 $ 1,600 70 1,20Adjustment Information Nov. 2 Nov. 3 The business paid $1,600...
-
Solve: log (2x) = log3 (3x+2). =1
-
A rectangular plot of land where outdoor concerts are held is about to be enclosed by a fence. How many feet of fence will be needed if the plot is 170 yards on one side and 270 feet on the other,...
-
Cooling also prevents the oil on the engine parts from breaking down and losing lubrication properties. While the engine must be cooled, it still needs to operate at a high temperature. What will...
-
Mass air flow (MAF) sensors are designed to work with other temperature and pressure sensors in the intake circuit. This allows the PCM to compensate for four [4] changing conditions such as?
-
Air cooling takes place when heat from a running engine is transferred from fins to the surrounding air. The rate at which this cooling takes place depends on four [4] requirements. What are they?
-
What is the anode in an alkaline battery?? ------ Describe the electrodes in this nickel-copper galvanic cell. a. Drag the appropriate items to their respective bins. anode cathode gains mass loses...
-
What can you do to reduce hunger where you live? To reduce hunger globally?
-
Sometimes, directory or file names have numbers in the middle, and there may be more than one number, for example, sec3_14.txt or sec10_1.txt. Provide a comparator that can compare such strings in a...
-
Write pseudocode for a program that computes the first and last digit of a number. For example, if the input is 23456, the program should print 2 and 6. Hint: %, Math.log10.
-
Consider the following code segment. double purchase = 19.93; double payment = 20.00; double change = payment - purchase; System.out.println(change); The code segment prints the change as...
-
If a politician running for office does not speak in general terms, does not try to move to the middle of the political spectrum, and does not take polls, is the median voter model therefore wrong?
-
Voters often criticize politicians running for office who do not speak in specific terms (i.e., who do not specify which spending programs will be cut, whose taxes will be raised, etc.). If voters...
-
Why is rent-seeking activity socially wasteful?
Study smarter with the SolutionInn App