Datasets:
Download code/math_code_011_verify.py from efe-T/bilingual-math-code-verification-v1: direct link, hf CLI and curl.
- Browser
- Download file 680 Bytes
-
https://huggingface.co/datasets/efe-T/bilingual-math-code-verification-v1/resolve/main/code/math_code_011_verify.py
- Command line
-
hf download hf://datasets/efe-T/bilingual-math-code-verification-v1/code/math_code_011_verify.py
-
curl -L -o math_code_011_verify.py https://huggingface.co/datasets/efe-T/bilingual-math-code-verification-v1/resolve/main/code/math_code_011_verify.py
680 Bytes
| from fractions import Fraction | |
| gross_cents = 3 * 1250 + 2 * 800 | |
| goods_cents = gross_cents * 9 // 10 | |
| assert gross_cents * 9 % 10 == 0 | |
| shipping_cents = 500 if goods_cents < 5000 else 0 | |
| raw_tax_cents = Fraction(goods_cents * 8, 100) | |
| rounded = raw_tax_cents + Fraction(1, 2) | |
| tax_cents = rounded.numerator // rounded.denominator | |
| def money(cents): | |
| return f"{cents // 100}.{cents % 100:02d}" | |
| result = {"gross": money(gross_cents), "discounted_goods": money(goods_cents), | |
| "shipping": money(shipping_cents), "tax": money(tax_cents), | |
| "total": money(goods_cents + shipping_cents + tax_cents)} | |
| import json | |
| print(json.dumps(result, ensure_ascii=False, sort_keys=True)) | |