This project build in Python is a command line application. Users can check they knowledge of most known Horror Movies by answering 10 horror related questions. After each question they are informed do they answer is correct or not. Score they achieved is returned to them at the end of the quiz as well as option to play again if they want to improve they score.
- Flowchart
- Wireframe
- User Experience
- Features
- Invalid Data Handling
- Data Model
- Testing
- Bugs
- Resources Used
- Deployment
- Credits
I used Lucid to create simple flowchart of how project should work from start to end. These helped me to visualise the structure of the code and which functions may be needed.
I made a simple wireframe on a piece of paper including all 10 questions and answers. I've also been told from one of my class student about ASCII convertor, thanks to her I create a quiz title using this app.
- Provide the User with a easy to play, multiple choice quiz.
- Provide some visuals with the use of colours to contribute to a positive user experience.
- Display the user’s score clearly at the end of the quiz.
As a User I want:
- To play easy to use quiz.
- Have clear instructions how to play.
- To test my knowledge of popular Horror Movies.
- To be informed when my input is invalid and what are the steps to correct it.
- To se whats my total score at the end of the quiz.
- To be easily repeat the quiz, if I want to play again or end it if I want to finish.
Project Goal - Provide some visuals with images and colour to contribute to a positive user experience.
I used ASCII font 'ANSI Shadow', to create quiz title and Python module 'Colorama' to add color within the terminal.
The first input in the program asks the user to enter their name. This gives some personalisation to the quiz, as the program returns the name as a welcome.
Provide clear instructions on how to use the quiz.
After the user has entered their Name, they are given a personalised welcome message, and are presented with a short description and simple instructions for the quiz.
User is then asked if they are ready to start the quiz by typing 'y' for yes or 'n' for no. This allows User initiation and control of the logic flow in this stage of the program. If the User types 'y' the quiz will begin and if 'n' is typed a message will appear asking them to type 'y' when ready, and the question repeats.
Project Goal - provide the User with easy to play multiple choice quiz, where they can test thair knowledge of Horror Movies
The quiz contains 10 multiple choice questions of, which are iterated through in the same order each time the program is run. Each correctly answered question scores 1 point, and if the question is answered incorrectly then 0 points are awarded. To improve readability I have coloured the questions blue, and used the 'style.bright' Colorama feature to add boldness to the text.
If the correct answer is selected by the user, they are informed with the output 'You're right' which is colored in green, followed by the next question. If an incorrect answer is selected, the output 'You're wrong' is shown in red.
Project Goal - display the user’s score clearly at the end of the quiz Ask User If they want to repeat the game
Once all 10 questions have been iterated through, the user is then presented with their final score. Different messages are displayed, depending on whether the score is equal to or less than 6, or greater than 6. The message is personalised with the users Name.
The user is also asked if they would like to play again, by typing 'y' for yes or 'n' for no. If 'y' is typed the program sequence starts again. If 'n' is typed, a message informs the user that the quiz has ended and to click the 'Run Program' button if they wish to reset the quiz.
##Lower or Upper case characters All input will be accepted in lower or upper case as long as the inserted input is allowed.
Users must enter a string of text in the Name input before they can proceed. If the input is left blank, or contains just whitespace, then an error message is displayed and the input is requested again.
Users must type 'y' or 'n' to indicate if they are ready to start the quiz. If they enter any other character an error message is displayed and the input is requested again.
Users must type 'a', 'b', 'c' or 'd' to select their chosen answer. If they enter any other character an error message is displayed and the question will be repeated. An invalid answer like this does not effect the users end score.
Users must type 'y' or 'n' to indicate whether or not they wish to play again. If they enter any other character an error message is displayed and the input is requested again.
In these program dictionary was used to store quiz questions and answers. That will help add more questions in the future without amend any code. This has been achieved by the use of f-Strings in print statements, so that accurate data is always displayed for the user score.
I made following manual tests throughout the deployment process:
- Given invalid input at each input stage to check invalid data is dealt with in the way I expected.
- Checked f-Strings to ensure that output data is updated automatically and remains accurate, particularly if questions are added to the dictionary.
- Tested in my local terminal and the deployed Heroku terminal.
- Asked friends to play the game and ask if the instructions are easy to follow.
I ran my code through PEP8 validator which I added to my Gitpod workspace, as PEP8 website was not availble. One issue was finde with Trailing whitespace in several lines.
Problem fixed.
Some gitpod.yml issues was detected. Not fixed.
Test accessibility and performance with Ligthouse.
- Exception has occured: EOFError in line 97
- When I first ran the code through the PEP8, it informed me that some of the code lines in the dictionary were too long. This was also causing some individual words to break in the middle and displaying incorrectly in the terminal. I fixed this by inserting a back slash at the line length limit point and putting all characters after the back slash onto a new line. I had to position the new line carefully so that the questions would still display in the terminal without additional whitespace. Broken words were fixed by using a new line character.
- On first session witch my mentor She noticed that when she wanted to start the quiz no input was needed(yes or no) as enter tab started the game. I fixed that issue adding if else statement.
My project was deployed via Heroku app using Code Institute video Deployment Video, with following steps:
- In Heroku account, go to Dashboard and click ‘Create New App’. Give the app a unique name and select region (Europe).
- Click ‘Create App’(give project unique name).
- Click 'Settings', select Config Var, type PORT in key section and 8000 in value section.
- Click ‘Add Buildpack’, select Python and click ‘Save Changes’.
- Then select ‘NodeJS’ and click save again. IMPORTANT - Buildpacks should be in order. Python on top of NodeJS.
- Click on ‘Deploy’ tab.
- Select ‘GitHub' as deployment method.
- Search for repo name and connect.
- Click ‘Enable Automatic Deploys’.
- Ensure that ‘main’ branch is selected in Manual deploy section and click ‘Deploy Branch’.
- Once deployed, click ‘view’ to access deployed project.
Questions for quiz was taken from:
- I used Sean Quirke and Ollie Train_5P projects to get idea how I want my project to look like.
- I used Mohammad Hashemi answer on programing portal to fix Trim Trailing Whitespace issue.
- I get help from classmate Ivette McDermott with title fancy fonts. She suggested to me, to use ASCII text validator to get result which I was looked for.
- Love Sandwiches project for reference and guidance.
- I used You Tube video to get idea how to start my project Bro Code
- Martina Terlevic (mentor)