Question: Python, I am working on the code down below but I want it to have the method do the counting and then have the counts

Python, I am working on the code down below but I want it to have the method do the counting and then have the counts return to the main() also I want the method to be either set or dictionary. Any help on this is appreciated! The pupose of the code it to have a function named numVowels that is passed a string containing letters, each of which may be in either uppercase or lowercase, and returns a tuple containing the number of vowels and the number of consonants the string contains. Python, I am working on the code down below but I want

import re def countinput(txt): z re.sub(r"\W", "", txt) vowels = ' aeiouy' avowel s = 0 aconsonants = 0 for c in z: if c in vowels avowels += 1 else: aconsonants += 1 print('This string has n1) vowels and n2} consonents'.format (n1-avowels, n intxt = input(' Please type in a string of characters: ').lower() countinput(intxt) Ln: 15 Col: 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!