WEBVTT

00:00.000 --> 00:05.000
Simple projects integrating learned concepts.

00:05.000 --> 00:11.000
In this video, we will create a project using the concepts learned in previous lessons.

00:11.000 --> 00:18.000
We will use data structures to store and manage data, implement functions for modular and reusable code,

00:18.000 --> 00:24.000
perform file handling to save and retrieve data.

00:24.000 --> 00:26.000
Data structure.

00:26.000 --> 00:30.000
The program starts with a list of dictionary objects stored in questions.

00:30.000 --> 00:39.000
Each dictionary represents a question with the quiz question, the possible answer choices, and the correct answer.

00:39.000 --> 00:44.000
Function definitions. The program has four functions.

00:44.000 --> 00:49.000
Display question function. It displays the question along with its answer choices.

00:49.000 --> 00:55.000
Check answer function compares the user's answer with the correct answer and returns.

00:55.000 --> 00:58.000
True if correct, otherwise false.

00:58.000 --> 01:04.000
Calculate score function calculates the percentage score based on the number of correct answers.

01:04.000 --> 01:12.000
Save score. This function saves the final score to a text file as scores.txt.

01:12.000 --> 01:15.000
Main function.

01:15.000 --> 01:21.000
Function runs the quiz game. Initialize correct count to keep track of correct answers.

01:21.000 --> 01:26.000
Loop through all questions. Display the question and options.

01:26.000 --> 01:33.000
Ask the user to input their answer. Validate the answer. Must be A, B, or C.

01:33.000 --> 01:37.000
Compare with the correct answer and provide feedback.

01:37.000 --> 01:42.000
Update. Correct count if the answer is correct.

01:42.000 --> 01:46.000
Calculate the final score and display it.

01:46.000 --> 01:52.000
Save the score in scores.txt.

01:52.000 --> 01:54.000
Running the program.

01:54.000 --> 02:05.000
The main function executes automatically. The user is prompted to answer each question.

02:05.000 --> 02:11.000
At the end, the final score is displayed and stored in scores.txt.

02:11.000 --> 02:15.000
We learned how to create a simple quiz program using Python.

02:15.000 --> 02:24.000
By applying key concepts like data structures, functions, and file handling, we built an interactive project.

