Question Engine for Trivia Queston DB
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file quizengine4trivia_tirsvadcli-0.0.6.tar.gz
.
File metadata
- Download URL: quizengine4trivia_tirsvadcli-0.0.6.tar.gz
- Upload date:
- Size: 45.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c917ade4530931f1eb64aed98664e81dbdfb157fb316108689c95343af29a86 |
|
MD5 | 033f923a12a0d182b50bbb77ecd043c8 |
|
BLAKE2b-256 | e8d4c4a33aaf3eac64cc827204ed0b8e4b284d05e95e5e96129af97d88818c78 |
File details
Details for the file QuizEngine4Trivia_TirsvadCLI-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: QuizEngine4Trivia_TirsvadCLI-0.0.6-py3-none-any.whl
- Upload date:
- Size: 30.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac7a8a1d4bfd16ee946240aab57fb9e07904441492c8270828e362126f02d0eb |
|
MD5 | 45202dd4a16ded0f37f768ad6c90a27c |
|
BLAKE2b-256 | 6342fe0794f55f96b9073c088dece8dac703a6bc1a6025b6b119521060cb4f8d |