Quiz Engine for Trivia
Getting Started
Quiz Engine for Trivia module
Easy to create a quiz game by using this module.
Prerequisites
You have python 3 installed.
Use
In a terminal do following
pip install tirsvadCLI-quiz_engine_4_trivia
from QuizEngine4Trivia import QuizEngine
import html
quiz = QuizEngine()
while quiz.still_has_questions():
current = quiz.next_question()
user_answer: int = -1
count = 0
while not 0 <= user_answer <= count:
count = 0
print(f"Your score : {quiz.score}\n\n")
print(f"{html.unescape(current.category)}")
print(f"{html.unescape(current.question)}\n")
for possible_answer in current.possible_answers:
print(f"{count}: {html.unescape(possible_answer)}")
count += 1
count -= 1 # roll back last increment
user_answer = int(input("Answer .:"))
if quiz.check_answer(current.possible_answers[user_answer]):
print("You are right")
else:
print("You are wrong")
print("You've completed the quiz")
print(f"Your final score was: {quiz.score}/{quiz.question_number}")
# show the right correct answer for those we didn't know the answers on
for result in quiz.get_result():
if not result[0]:
print(html.unescape(result[1]))
print(html.unescape(result[2]))
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
Fork the Project
- Fork the Project
- Create your Feature Branch
- Commit your Changes
- Push to the Branch
- Open a Pull Request
Example
git checkout -b feature
git commit -m 'Add my feature enhance to project'
git push origin feature
Release files for QuizEngine4Trivia-TirsvadCLI 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| quizengine4trivia_tirsvadcli-0.0.6.tar.gz | 45.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| QuizEngine4Trivia_TirsvadCLI-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 76.2 kB
Release files / quizengine4trivia_tirsvadcli-0.0.6.tar.gz
| Download URL | quizengine4trivia_tirsvadcli-0.0.6.tar.gz |
|---|---|
| Size | 45.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c917ade4530931f1eb64aed98664e81dbdfb157fb316108689c95343af29a86
|
|
BLAKE2b-256 checksum How to use checksums |
e8d4c4a33aaf3eac64cc827204ed0b8e4b284d05e95e5e96129af97d88818c78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.11.9
|
Release files / QuizEngine4Trivia_TirsvadCLI-0.0.6-py3-none-any.whl
| Download URL | QuizEngine4Trivia_TirsvadCLI-0.0.6-py3-none-any.whl |
|---|---|
| Size | 30.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ac7a8a1d4bfd16ee946240aab57fb9e07904441492c8270828e362126f02d0eb
|
|
BLAKE2b-256 checksum How to use checksums |
6342fe0794f55f96b9073c088dece8dac703a6bc1a6025b6b119521060cb4f8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.11.9
|