title: How to count vowels and consonants in Python?
body: <p>I am trying to write a program that counts vowels and consonants in Python, then print the number of vowels and consonants in two statements. The vowels and consonants have to be in two different functions. I have most of it complete but I cannot figure out two errors.</p>
  
  <p>1.) How to stop my script from printing a new line for each count of the vowels. I have tried numerous variations of accumulators and print statements but none seem to work.</p>
  
  <p>2.) I cannot get my countConsonants function to run at all. I am assuming I would have similar problems to number one but I cannot get it to even run. I am assuming it has to do with the way I am calling the function from the main function but I am not sure.</p>
  
  <p>Here is what I have:</p>
  
  <pre><code>def main():
     user_input = input("Enter a string of vowels and consonants: ")
     vowel_list = set(['a','e','i','o','u'])
     countVowels(user_input, vowel_list)
     countConsonants(user_input, vowel_list)
  
  def countVowels(user_input, vowel_list):
      user_input.lower()
      index = 0
      vowels = 0
  
      while index &lt; len(user_input):
          if user_input[index] in vowel_list:
              vowels += 1
              index += 1
              print ('Your input has', vowels , 'vowels.')
  
  def countConsonants(user_input, vowel_list):
      user_input.lower()
      index = 0
      consonants = 0
  
      while index &lt; len(user_input):
          if user_input[index] not in vowel_list:
              consonants += 1
              index += 1
              print ('Your input has' , consonants , 'consonants.')
  
  main()
  </code></pre>
  
  <p>Here is an IO:</p>
  
  <pre><code>Enter a string of vowels and consonants: aaeioulkjj
  Your input has 1 vowels.
  Your input has 2 vowels.
  Your input has 3 vowels.
  Your input has 4 vowels.
  Your input has 5 vowels.
  Your input has 6 vowels.
  </code></pre>