Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON HELP! This is the code i have now: def q1c(): String = Banana lowerb = String.lower() print(lowerb) #counting vowels count = 0 for char

PYTHON HELP!

This is the code i have now:

def q1c(): String = "Banana" lowerb = String.lower() print(lowerb) #counting vowels count = 0 for char in lowerb: if char in 'aeiou': count += 1 print(count) #remove all spaces and duplicate characters nospace = ''.join(set(lowerb)) print(nospace) #counting updated vowels newcount = 0 for char in nospace: if char in "aeiou": newcount += 1 print(newcount)#had to take print out of loop

list = ["lowerb","count","nospace","newcount"] return list q1c()

but i can't get it to accept any word, or return the list at the end.image text in transcribed

Question 1c: Write a function named q1c ()that accepts one parameter, a String, which will be modified and evaluated as follows 1. Convert the entire String to lower-case 2. Count the total number of vowels in the String (a, e, i, o and u 3. Remove all spaces and duplicate characters from the String 4. Count the remaining vowels in the String (a, e, i, o and u) including duplicates) After each step is complete, the results are stored as values in a List. Once the entire evaluation process is complete, the qlc function should return the List. For example, consider the String Banana' The string is converted to lower case 'banana' The number of vowels are counted All spaces and duplicate characters removed The remaining number of vowels are counted an The q1c () function returns this List I "banana', 3, "ban', 11 Example Input/ Output: >>qla ("banana" "banana',3 >> qla ('apple) 'apple', 2, 'aple',2] >>qla ('orange) orange', 3, orange',3] ban' 'turn down for what', 4, 'turndowfha', 3] >>qla (Boilermakers Rock The House Baby) 'boilermakers rock the house baby',11, 'boilermakscthuy', 5] S> Note: The function returns the List - it does not print anything

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions