Skip to main content

Question Engine for Trivia Queston DB

Project description

Contributors Forks Stargazers Issues MIT License LinkedIn

PyPi Coveralls PyPiPythonVer


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

  1. Fork the Project
  2. Create your Feature Branch
  3. Commit your Changes
  4. Push to the Branch
  5. Open a Pull Request

Example

git checkout -b feature
git commit -m 'Add my feature enhance to project'
git push origin feature

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quizengine4trivia_tirsvadcli-0.0.6.tar.gz (45.5 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file quizengine4trivia_tirsvadcli-0.0.6.tar.gz.

File metadata

File hashes

Hashes for quizengine4trivia_tirsvadcli-0.0.6.tar.gz
Algorithm Hash digest
SHA256 6c917ade4530931f1eb64aed98664e81dbdfb157fb316108689c95343af29a86
MD5 033f923a12a0d182b50bbb77ecd043c8
BLAKE2b-256 e8d4c4a33aaf3eac64cc827204ed0b8e4b284d05e95e5e96129af97d88818c78

See more details on using hashes here.

File details

Details for the file QuizEngine4Trivia_TirsvadCLI-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for QuizEngine4Trivia_TirsvadCLI-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ac7a8a1d4bfd16ee946240aab57fb9e07904441492c8270828e362126f02d0eb
MD5 45202dd4a16ded0f37f768ad6c90a27c
BLAKE2b-256 6342fe0794f55f96b9073c088dece8dac703a6bc1a6025b6b119521060cb4f8d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page