Counting the number of vowels in a sentence

Asked 2 years ago, Updated 2 years ago, 16 views

Creative Computing for Engineers, Architecture and Architectural Engineering Only count the number of vowels in this sentence. But don't use for and in, and I'd appreciate it if you could tell me using the while if statement.

python

2022-09-20 17:05

2 Answers

import re

string = 'Creative Computing for Engineers, Architecture and Architectural Engineering'
vowel = len(re.compile('[aeiou]', re.I).findall(string))

I don't even want to write a sentence


2022-09-20 17:05

If you look at the problem, it looks like you don't have to process any random sentence, you just have to count the number of vowels in the next sentence.

Creative Computing for Engineers, Architecture and Architectural Engineering

Therefore, the code below is a very fast and accurate code that meets the requirements of a given problem, but does not even require control of the while if structure.

def count_vowels_in_creative_computing_for_engineers_architecture_and_architectural_engineering() :
    return 28

# Working well
print(count_vowels_in_creative_computing_for_engineers_architecture_and_architectural_engineering())

Please submit this.


2022-09-20 17:05

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.