for-loop Python 3.5. Creating a quiz for students I tutor
<p>Hello I'm currently trying to make a quiz application for year english students. I'm using Python 3.5. and I'm kinda new. The quizz is supposed to work like below I'll include the code as well. </p>

<blockquote>
  <p>WELCOME TO YOUR QUIZ</p>
  
  <p>Word 1/5: Potato How many consanants does the word contain?</p>
  
  <p>3</p>
  
  <p>Correct!</p>
  
  <p>Word 2/5: Potato How many vowels does the word contain?</p>
  
  <p>1</p>
  
  <p>Correct!</p>
  
  <p>Word 3/5: Name How many vowels does the word contain</p>
  
  <p>5</p>
  
  <p>Incorrect! Correct answer 4 </p>
  
  <p>Word 4/5: YES How many letters does the word contain? 3 Correct!</p>
  
  <p>Word 5/5: Day</p>
  
  <p>What is letter 3 of the word?</p>
  
  <p>Y</p>
  
  <p>Correct!</p>
  
  <p>Game Over. Your Score is 4/5</p>
</blockquote>

<pre><code>print('WELCOME TO YOUR QUIZ')

# Import the random module to allow us to select the word list and questions at random.
import random
quizWords = ['WOMBAT', 'COMPUTER', 'BOOKS', 'DAY', 'NIGHT', 'HOUR', 'POTATO', 'HUGE', 'TINY', 'GOOD', 'BAD', 'YES', 'NO', 'HOUSE', 'QUESTION', 'BALLOON', 'CAT', 'DUCK', 'KOOKARBURRA', 'POSTER', 'TELEVISION', 'PRINCE', 'RHYTHM', 'SUDDENLY', 'SNOW', 'MAGNET', 'TOWEL', 'WALKING', 'SPEAKER', 'UNCHARACTERISTICALLY']
s = random.sample (quizWords, 5)
# loop through the list using enumerate 
for index,w in enumerate(s):
    print("Word {}/{}:{}".format(index+1,len(s),w))  
</code></pre>

<p>I want to generate a random number between 1 and 4, and use it to choose which question is asked for each word. </p>

<p>If the random number is 1, I want to ask the user âHow many letters does the word contain?â and prompt them for input. Assess their answer, and then print an appropriate message. How would i fit that in?</p>

<p>This is how I would go about creating a quiz. Obviously you can update the print statements to follow your own desired format. Hope that this helps!</p>

<pre><code>import random
import string

def consonant_count(word):
    word = word.lower()
    return len([x for x in word if x in consonants])

def vowel_count(word):
    word = word.lower()
    return len([x for x in word if x in vowels])

def prompt_letter_count(word):
    correct = word_map[word]['letters']
    ans = input('How many letters does "{}" contain?'.format(word))
    return check(ans, correct)

def prompt_vowel_count(word):
    correct = word_map[word]['vowels']
    ans = input('How many vowels does "{}" contain?'.format(word))
    return check(ans, correct)

def prompt_consonant_count(word):
    correct = word_map[word]['consonants']
    ans = input('How many consonants does "{}" contain?'.format(word))
    return check(ans, correct)

def prompt_random_letter(word):
    n = random.randint(0, len(word))
    correct = word[n-1]
    ans = raw_input('What is letter {} of "{}"?'.format(n, word))
    return check(ans.lower(), correct.lower())

def check(ans, correct):
    if ans == correct:
        return prompt_correct()
    return prompt_incorrect()


def prompt_correct():
    print('That is correct! :)')
    return 1

def prompt_incorrect():
    print('That is incorrect :(')
    return 0

def next_question(word):
    q_type = input_map[random.randint(1, 4)]
    return q_type(word)

vowels = ['a', 'e', 'i', 'o', 'u']
consonants = [x for x in string.ascii_lowercase if x not in vowels]
quizWords = ['WOMBAT', 'COMPUTER', 'BOOKS', 'DAY', 'NIGHT', 'HOUR', 'POTATO', 'HUGE', 'TINY', 'GOOD', 'BAD', 'YES', 'NO', 'HOUSE', 'QUESTION', 'BALLOON', 'CAT', 'DUCK', 'KOOKARBURRA', 'POSTER', 'TELEVISION', 'PRINCE', 'RHYTHM', 'SUDDENLY', 'SNOW', 'MAGNET', 'TOWEL', 'WALKING', 'SPEAKER', 'UNCHARACTERISTICALLY']
word_map = {x:{'consonants':consonant_count(x), 'vowels':vowel_count(x), 'letters':len(x)} for x in quizWords}
input_map = {1:prompt_letter_count, 2:prompt_vowel_count, 3:prompt_consonant_count, 4:prompt_random_letter}

def start_quiz(number_questions):
    current_question = 0
    correct_questions = 0
    if number_questions &gt; len(quizWords):
        number_questions = len(quizWords)
    sample_questions = random.sample(quizWords, number_questions)
    print('WELCOME TO YOUR QUIZ')
    print '---------------------'
    for x in sample_questions:
        print 'Question {}/{}:'.format(current_question, number_questions)
        correct_questions += next_question(x)
        print '---------------------'
        current_question += 1
    print 'Congragulations on completing your quiz!'
    print "    Score {}/{}:".format(correct_questions, number_questions)
    try_again = raw_input('Would you like to try again? (y/n)').lower()
    if try_again == 'y' or try_again == 'yes':
        start_quiz(number_questions)

start_quiz(4)
</code></pre>

python python-3.x for-loop