Giter VIP home page Giter VIP logo

pytexexam's Introduction

pytexexam

A simple library for writing and printing exam in Python.

Downloads Downloads Downloads Run on Repl.it

Install

Install from pypi

pip install pytexexam

Install from github

pip install git+https://github.com/vungocbinh2009/pytexexam.git#egg=pytexexam

How to use

from pytexexam.component import Text, MultipartQuestion, OpenQuestion, ComponentGroup, MultipleChoiceQuestion, QuestionPart
from pytexexam.latex_util import two_column_header
from pytexexam import ExamGenerator, ExamFileType


# Create an exam generator object
exam = ExamGenerator()

# Then, you can create "component" to add to your exam.

# Create a text component to use as header.
header = Text(two_column_header("Left column", "Right column"))

# Create a multiple choice question and shuffle answer.
q1 = MultipleChoiceQuestion(
    question="This is a multiple choice question",
    answers=["Answer 1", "Answer 2", "Answer 3", "Answer 4"],
    true_answer="AB",
    num_column=4,
    solution="Multiple choice question solution"
)
q1.shuffle_content()

# Create a question with multi part whose can shuffle it part
q2 = MultipartQuestion(
    question_stem="Answer all the question below",
    prompts=[
        QuestionPart("Question part 1", "Answer 1", "Solution 1"),
        QuestionPart("Question part 2", "Answer 2", "Solution 2"),
        QuestionPart("Question part 3", "Answer 3", "Solution 3"),
        QuestionPart("Question part 4", "Answer 4", "Solution 4"),
    ],
    num_column=2
)
q2.shuffle_content()

# Create a open question
q3 = OpenQuestion(
    question="This is an open question",
    answer="This is open question answer",
    solution="This is open question answer"
)

# Create text to split each part of the test.
text = Text(r"\section{{An exam section}}")

# You can subclass "Component" from pytexexam.component
# to create your own question type.

# Create a question group to add all component together, add to exam generator
q_group = ComponentGroup([header, q1, text, q2, q3])
exam.add_component(q_group)

# Add preamble.
exam.add_preamble_array([
    r"\usepackage[utf8]{vietnam}"
])

# Generate exam
exam.generate_exam("exam1", ExamFileType.PDF)

Contribution.

Contribution are welcome. Create a pull request.

Buy me a coffee.

If you find this project useful, you can buy me coffee through Buy me a coffee

Buy Me A Coffee

License

Apache License, Version 2.0

pytexexam's People

Contributors

pythoncatcoder avatar vungocbinh2009 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pytexexam's Issues

recommend pylatex

It is better to use pylatex to generate the latex code. I am interested in the project, and made a similar one.

module "answer" not found

Hi,
I was testing the app and I have found this error:

/usr/local/lib/python3.6/dist-packages/pytexexam/question.py in ()
----> 1 from answer import Answer
2 import random
3 from typing import Dict
4
5

ModuleNotFoundError: No module named 'answer'

`
Something missing?
Regards
Robert

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.