Quiz Engine for Trivia module
Easy to create a quiz game by using this module.
You have python 3 installed.
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]))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
