damn
damn (desperately agonizing math noobs) is a language to help you write knowledge assessment test generators.
Language will help you in variables constraints declaration and generate unique pairs of data. Then, the generated pair of variables can be evaluated with the formula (via wolframalpha integration).
Syntax:
1 > x > 10
y in [1, 2, 3]
(a, b) in [(4, 5), (1, 10)]
Example
Constraints:
10 > a > 20
(v1, v2) in [(1, 2), (4, 8)]
Formula:
a = (v2 - v1)/t
Making a test:
from damn import DefinitionSet, Calculator
import asyncio
calculator = Calculator(["DEMO"])
async def main():
def_set = DefinitionSet.from_expressions([
"10 < a < 20",
"(v1, v2) in [(1, 2), (4, 8)]"
])
data = def_set.get_data()
print(
"What is delta t if " +
", ".join(
(f"{k} = {v.get_common_representation()}" for k, v in data.items())
)
)
result = await calculator.calculate(data, "a = (v2 - v1)/t")
answer = float(input("your answer > "))
if answer == result.v:
print("great!!")
return
print(f"BAD student. the right answer is {result.v}")
asyncio.run(main())
Metadata
Release files for damnlang 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| damnlang-0.1.1.tar.gz | 5.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| damnlang-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.2 kB
Release files / damnlang-0.1.1.tar.gz
| Download URL | damnlang-0.1.1.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0c2ec8c1167aef0f373a3fad15af3d6b4156abfe29fbbf4c876254898e6ad1c2
|
|
BLAKE2b-256 checksum How to use checksums |
f93247d689d1592badfe5b6344b7f28adacaf3e6bcd81216a00d03fc7e0583fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.0 CPython/3.10.8 Darwin/21.3.0
|
Release files / damnlang-0.1.1-py3-none-any.whl
| Download URL | damnlang-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c33a63df8722055d3ccc0612858b0773b221d926ff521fbf7ede6ebd3713ffce
|
|
BLAKE2b-256 checksum How to use checksums |
c1229ec461913c98f60185a7d25474372d5d8e31cd2e86d40c6275d2ee477278
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.0 CPython/3.10.8 Darwin/21.3.0
|