Python Quiz App: Test Your Coding Knowledge!

Introduction
Are you ready to put your Python knowledge to the test? This simple Python quiz app challenges you with five multiple-choice questions on Python programming.

Features of the Quiz App:-

  1. Five Multiple-Choice Questions: Each question has four options.
  2. One Correct Answer per Question: Choose the correct option from (a), (b), (c), or (d).
  3. Score Calculation: The app calculates your total score out of five.
  4. Performance Feedback: Based on your score, you receive personalized feedback.
  5. View Correct Answers: After completing the quiz, you can review the correct answers.

How It Works:-

When you run the script, you’ll see the quiz instructions and be prompted to enter ‘yes’ to start. You’ll be asked to provide your name and login ID before beginning the quiz.

For each question, type your answer and press Enter. At the end of the quiz, your score is displayed, and you receive feedback based on your performance. If you wish, you can view the correct answers.

Code Breakdown:-

Here’s how the quiz works under the hood:

1. Question Class

The quiz app utilizes a Question class to store the question prompt and the correct answer.

2. List of Questions

A list of Question objects is created, each containing a question and its respective correct answer.

3. Quiz Execution

The run_test() function loops through the questions, asks the user for input, and checks if their response is correct.

4. Scoring System

After answering all five questions, the user receives their total score, and based on it, they get one of the following messages:

  • 0-2 correct answers: “Try again, Keep yourself updated”
  • 3-4 correct answers: “WELL DONE!!”
  • 5 correct answers: “EXCELLENT!!”

5. Viewing Correct Answers

If the user wants, they can type ‘yes’ to see the correct answers after completing the quiz.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top