Damn
Project description
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())
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file damnlang-0.1.1.tar.gz.
File metadata
- Download URL: damnlang-0.1.1.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0 CPython/3.10.8 Darwin/21.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c2ec8c1167aef0f373a3fad15af3d6b4156abfe29fbbf4c876254898e6ad1c2
|
|
| MD5 |
beeee4917d3298d00dff6f90cc6064c9
|
|
| BLAKE2b-256 |
f93247d689d1592badfe5b6344b7f28adacaf3e6bcd81216a00d03fc7e0583fb
|
File details
Details for the file damnlang-0.1.1-py3-none-any.whl.
File metadata
- Download URL: damnlang-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0 CPython/3.10.8 Darwin/21.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c33a63df8722055d3ccc0612858b0773b221d926ff521fbf7ede6ebd3713ffce
|
|
| MD5 |
d502620003d10cd1cb0123fd9757dc46
|
|
| BLAKE2b-256 |
c1229ec461913c98f60185a7d25474372d5d8e31cd2e86d40c6275d2ee477278
|