Skip to content

Marie-L1/Python-Quiz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Python-Quiz

CS50 Python Final Project- submitted within the CS50 Repository. #### Description: For my final project, I created a quiz testing the user on their Python knowledge. Each of the questions is basic Python. Anyone who took the CS50 Python course or has any general knowledge about programming with Python should know the answers to these questions. I started by creating an introduction for the quiz. I looked further into the font variations for FIGlet and created a fun title. I made sure to keep this introduction outside of the main function, so it only runs at the beginning of the quiz, not when each question is prompted to the user. FIGlet was the only library I researched for my project, but I already had experience using it in Week 4. I wanted my quiz to have an amusing feeling to it, making it a little less dull to look at. Within my main function, I contained all the quiz questions, multiple choice answers, and correct answers in a list that contains dictionaries, which I pulled from later in my code. I wanted all the data for the questions to be stored together, making my code easier to read. Additionally, I made sure that I had a Value Error raised if the user inputs an answer that was not valid. As well as a ‘correct’ and ‘incorrect’ message each time the user answered one of the quiz questions. For scoring the user’s responses, my program iterates over each question and the user’s input, and then the percentage of the score is calculated. If the user scores 100% of the questions correctly, my program congratulates them, but if they make any mistakes, it just gives an encouraging message. I didn’t want to give the user another chance to answer the questions or give them the correct answer. After making sure my program ran smoothly without any bugs, I moved on to my testing program for this project. First, I tested if a user inputs an answer, still as a string but not a, b, c, or d, that the Value Error I included in my code is raised. Next, I tested the feedback messages for each of the questions, making sure that the feedback function returns as true if the answer is correct, and vice versa for the incorrect answers. Finally, I tested if my score was being calculated properly. I made sure the calculated score matched the expected score.

About

CS50 Python Final Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages