/**
 * Given a list of questions and a list of corresponding answers,
 * this function tests the knowledge of a psychologist by asking
 * the questions and checking if the answers are correct.
 *
 * @param questions A list of strings representing questions.
 * @param answers A list of strings representing correct answers.
 * @return True if all answers are correct, False otherwise.
 */
fun psychologistExam(questions: List<String>, answers: List<String>): Boolean {

    var correctAnswers = 0

    for (i in questions.indices) {
        println("Question ${i + 1}: ${questions[i]}")

        while (true) {
            print("Enter your answer: ")
            val answer = readLine()

            if (answer?.trim()?.toLowerCase() == answers[i].trim().toLowerCase()) {
                println("Correct answer!")
                correctAnswers++
                break
            }
        }
    }

    return correctAnswers == questions.size
}
/**
 * Given a list of questions and a list of corresponding answers,
 * this function tests the knowledge of a psychologist by asking
 * the questions and checking if the answers are correct.
 *
 * @param questions A list of strings representing questions.
 * @param answers A list of strings representing correct answers.
 * @return True if all answers are correct, False otherwise.
 */
fun psychologistExam(questions: List<String>, answers: List<String>): Boolean {
/**
 * Given a list of questions and a list of corresponding answers,
 * this function tests the knowledge of a psychologist by asking
 * the questions and checking if the answers are correct.
 *
 * @param questions A list of strings representing questions.
 * @param answers A list of strings representing correct answers.
 * @return True if all answers are correct, False otherwise.
 */
fun psychologistExam(questions: List<String>, answers: List<String>): Boolean {

    var correctAnswers = 0

    for (i in questions.indices) {
        println("Question ${i + 1}: ${questions[i]}")

        while (true) {
            print("Enter your answer: ")
            val answer = readLine()

            if (answer?.trim()?.toLowerCase() == answers[i].trim().toLowerCase()) {
                println("Correct answer!")
                correctAnswers++
                break
            }
        }
    }

    return correctAnswers == questions.size
}