title: Grammatically correct indefinite article in Python
body: <p>I am creating a random sentence generator that can apply the
  correct indefinite article (a, an) to the sentence.
  But I am getting results such as these:
  I eat a apple. I ride an bike. You eat an apple.
  &quot;a&quot; should come before the consonant, and &quot;an&quot; should come before the vowel: an apple; a bike.
  <strong>What am I doing wrong?</strong></p>
  <pre><code>Import random
  def main():
      pronoun = [&quot;I &quot;, &quot;You &quot;]
      verb = [&quot;kick &quot;, &quot;ride&quot;, &quot;eat &quot;]
      noun = [&quot; ball.&quot;, &quot; bike.&quot;, &quot; apple.&quot;, &quot; elephant.&quot;]
      ind_art = &quot;an&quot; if random.choice(noun[0]).lower() in &quot;aeiou&quot; else &quot;a&quot;
  
      a = random.choice(pronoun)
      b = random.choice(verb)
      c = ind_art
      d = random.choice(noun)
  
      print(a+b+c+d)
  main()
  </code></pre>