all AI news
How to count the numbers of vowels and consonants in a sentence in python
March 24, 2024, 10:19 a.m. | Mangala
DEV Community dev.to
This program prompts the user to input a phrase, then counts the number of vowels and consonants present in that phrase, ignoring uppercase letters and considering only alphabetical characters.
def count_vowels_consonants(phrase):
vowels = 0
consonants = 0
# Converting the phrase to lowercase for easier comparison
phrase = phrase.lower()
# Defining a list of vowels
vowels_list = ['a', 'e', 'i', 'o', 'u']
# Iterating over each character in the phrase
for character in phrase:
# Checking if the character is …
characters comparison count developer numbers programming prompts python
More from dev.to / DEV Community
Jobs in AI, ML, Big Data
Software Engineer for AI Training Data (School Specific)
@ G2i Inc | Remote
Software Engineer for AI Training Data (Python)
@ G2i Inc | Remote
Software Engineer for AI Training Data (Tier 2)
@ G2i Inc | Remote
Data Engineer
@ Lemon.io | Remote: Europe, LATAM, Canada, UK, Asia, Oceania
Artificial Intelligence – Bioinformatic Expert
@ University of Texas Medical Branch | Galveston, TX
Lead Developer (AI)
@ Cere Network | San Francisco, US