- Tandem Software Engineer Apprenticeship Code Challenge
- One week sprint to build.
- The pdf file of full requirements can be found in the main project directory.
- Tech Stack
- Challenge Criteria
- Features
- Installation
- Testing
- Future Features
- Known Issues
- Resources
- Thanks
- Python
- Flask
- Javascript
- jQuery, AJAX
- Bootstrap
- A user can view questions.
- Questions with their multiple choice options must be displayed one at a time. Questions should not repeat in a round.
- A user can select only 1 answer out of the 4 possible answers.
- The correct answer must be revealed after a user has submitted their answer
- A user can see the score they received at the end of the round
Incorrect and correct answers are combined into one array and then randomized. Code for this can be found in /static/script.js.
The current question number is always visible, so users can keep track of the currect question number they are on.
Users click to select an answer. After selecting, the button with the correct answer will turn green. If an incorrect answer is selected, the selected button will turn grey. Other incorrect answer buttons will turn red.
After 10 questions are completed, users can view their score percentage and restart the quiz.
New questions are chosen randomly using random.sample. This function specifically samples without replacement, so no questions are repeated in a round. Code for this can be found in trivia.py.
To run Trivia Trainer on your own machine:
Clone or fork this repo:
https://github.com/vivsnguyen/Tandem-Trivia.git
Create and activate a virtual environment inside your Trivia Trainer directory:
virtualenv env
source env/bin/activate
Install the dependencies:
pip install -r requirements.txt
Run the app:
python3.6 app.py
You can now navigate to 'localhost:5000/' to access Trivia Trainer.
I used Doctests to test trivia.py.
To run Doctests, navigate to the Trivia Trainer directory and in your terminal run:
python3 -m doctest -v tests.txt
I tried to include certain features such as high contrast buttons, but would love to add alt-text to be read when an answer is chosen.
I want users to be able to login, save questions, view scores, and add their own questions to the trivia question bank. This is why I decided to send the question data to the front-end through the server. Later on, I would want to store the questions in a database.
I want to add more testing, such as integration tests for my flask server and testing for my front end features.
- Users can't change their mind on the answer they choose. I wasn't sure if I wanted to include this feature, because many quiz apps (like Kahoot!) don't allow you too. This could be a future feature that can be toggled on and off.
- Deciding how to store data
- Build A Quiz App With JavaScript
- MDN Web Docs
- Kap
Hi Tandem! Thanks for this opportunity and for taking the time to view my project.