# domain functions for Quiz CodeClub party Perth 2025-12-16
# rev 0.10  2025-11-30  initial release

import  random
from    m_database  import  database

def getQA (level):
    quiz = database(level)
    questions  = [quiz[i][0]    for i in range(5)]
    answers_ok = [quiz[i][1][0] for i in range(5)]
    answers    = [quiz[i][1]    for i in range(5)]
    for i in range(5): random.shuffle(answers[i])
    return questions, answers, answers_ok


def evaluate(answers_given, answers_ok):
    score = 0
    for a1, a2 in zip (answers_given, answers_ok):
        if a1 == a2: score += 1
    return score
