title: How to Count Vowels and Consonants in an Input Using Arrays?
body: <p>This is my assignment:</p>
  
  <blockquote>
    <p>Write a program which reads in text from the keyboard until '!' is found.</p>
    
    <p>Using an array of integers subscripted by the letters 'A' through 'Z',
    count the number occurrences of each letter (regardless of whether it
    is upper or lower case). In a separate counter, also count the total
    number of "other" characters.</p>
    
    <p>Print out the count for each letter found. Also, print the count of the non-letter 
    characters.</p>
    
    <p>By inspecting the array, print out the count of the number of vowels,
    and the number of consonants.</p>
  </blockquote>
  
  <p>and this is my code: </p>
  
  <pre><code>msg = input("What is your message? ")
  
  print ()
  
  num_alpha = 26
  int_array = [0] * num_alpha
  vowel = [0] * 10000
  consanant = [0] * 10000
  
  for alpha in range(num_alpha):
      int_array[alpha] = chr(alpha + 65)
      if int_array[alpha] == 'A' or int_array[alpha] == 'E' or int_array[alpha] == 'I' or int_array[alpha] == 'O' or int_array[alpha] == 'U':
          vowel[alpha] = int_array[alpha]
          print(vowel[alpha])
      else:
          consanant[alpha] = int_array[alpha]
  
  
  
  print()
  
  lett = 0
  otherch = 0
  num_vowels = 0
  num_consanants = 0
  
  count_character = [0] * 100000
  
  length = len(msg)
  
  for character in msg.upper():
      if character == "!":
          otherch = otherch + 1
          count_character[ord(character)] = count_character[ord(character)] + 1
          break
      elif character &lt; "A" or character &gt; "Z":
          otherch = otherch + 1
          count_character[ord(character)] = count_character[ord(character)] + 1
      else:
          lett = lett + 1
          count_character[ord(character)] = count_character[ord(character)] + 1
          if vowel[(alpha)] == (character):
              num_vowels = num_vowels + 1
              print(vowel[alpha])
          else:
              num_consanants = num_consanants + 1
  
  print("Number of Letters =", lett)
  print("Number of Other Characters = ", otherch)
  print("Number of Vowels = ", num_vowels)
  print("Number of Consanants = ", num_consanants)
  
  
  for character in msg.upper():
          print("Character", character, "appeared" , count_character[ord(character)] , "time(s).")
          if character == "!":
              break
  </code></pre>
  
  <p>Every time I input a string it does not recognize vowels. If i were to input "abe!" it would print:</p>
  
  <pre class="lang-none prettyprint-override"><code>Number of Letters = 3 
  Number of Other Characters =  1 
  Number of Vowels=  0 
  Number of Consanants =  3 
  Character A appeared 1 time(s). 
  Character B appeared 1 time(s). 
  Character E appeared 1 time(s).
  Character ! appeared 1 time(s).
  </code></pre>