Quiz Score Calculator
Score quiz answers and return a result summary.
5 upvotes
10 upvotes
Quiz Score Calculator
Score a quiz by matching each question with the answer the user gave. The final result should include the count, total, percentage, and a simple message.
Write these functions:
isAnswerCorrect(question, userAnswer)should returntruewhen the user's answer matches the correct answer.countCorrectAnswers(questions, userAnswers)should match each question with its user answer and return the number correct.calculatePercentage(correctCount, totalQuestions)should return the percentage score.getResultMessage(percentage)should return a short message based on the percentage.createQuizResult(questions, userAnswers)should returncorrectCount,totalQuestions,percentage, andmessage.
Sample checks:
Expected output:
If a user answer is missing, count that question as incorrect.
Solution
Solution:
