Python Vowel Consonant Counter Program

Day 17 of my #100DaysOfCode challenge 🚀 Today I worked on a Python program to count the number of vowels and consonants in a given string. The goal was to practice string traversal and character classification. What the program does: • Takes a string input from the user • Converts the string to lowercase for consistency • Checks each character individually • Counts vowels and consonants separately • Returns both counts How the logic works: A function count_vowels_consonants(string) is defined Two strings are created: – One containing all vowels (aeiou) – One containing all consonants Two counters are initialized to 0 The program loops through each character in the string If the character is in the vowel string, vowel count increases If the character is in the consonant string, consonant count increases The function returns both counts Example: Input: my name is SATISH KUMAR Output: Vowels: 7 Consonants: 12 Key learnings from Day 17: – Iterating through strings – Using conditional statements effectively – Handling case sensitivity with .lower() – Strengthening basic string manipulation skills #100DaysOfCode #Day17 #Python #PythonProgramming #StringManipulation #ProblemSolving #CodingPractice #LogicBuilding #LearnByDoing #ComputerScience #BTech #CSE #AIandML #VITBhopal #TechJourney

  • text

To view or add a comment, sign in

Explore content categories