user
Create a python program to detect the number of vowels and consonants in a string


assistant
def count_vowels_consonants(string): 
    vowels = 0
    consonants = 0
  
    for i in range(0, len(string)): 
          
        # If a vowel is found, increment the vowel count  
        if (string[i] == 'a' or string[i] == 'e' or string[i] == 'i' or string[i] == 'o' or string[i] == 'u'): 
            vowels = vowels + 1
  
        # If a consonant is found, increment the consonant count 
        else: 
            consonants = consonants + 1
  
    print("Vowels:", vowels) 
    print("Consonants:", consonants)