Datasets:
Download code/math_code_011_solution.py from efe-T/bilingual-math-code-verification-v1: direct link, hf CLI and curl.
- Browser
- Download file 620 Bytes
-
https://huggingface.co/datasets/efe-T/bilingual-math-code-verification-v1/resolve/main/code/math_code_011_solution.py
- Command line
-
hf download hf://datasets/efe-T/bilingual-math-code-verification-v1/code/math_code_011_solution.py
-
curl -L -o math_code_011_solution.py https://huggingface.co/datasets/efe-T/bilingual-math-code-verification-v1/resolve/main/code/math_code_011_solution.py
620 Bytes
| from decimal import Decimal, ROUND_HALF_UP | |
| cent = Decimal("0.01") | |
| gross = 3 * Decimal("12.50") + 2 * Decimal("8.00") | |
| goods = (gross * Decimal("0.90")).quantize(cent, rounding=ROUND_HALF_UP) | |
| shipping = Decimal("5.00") if goods < Decimal("50.00") else Decimal("0.00") | |
| tax = (goods * Decimal("0.08")).quantize(cent, rounding=ROUND_HALF_UP) | |
| total = goods + shipping + tax | |
| assert gross - goods == Decimal("5.35") | |
| result = {"gross": str(gross), "discounted_goods": str(goods), "shipping": str(shipping), | |
| "tax": str(tax), "total": str(total)} | |
| import json | |
| print(json.dumps(result, ensure_ascii=False, sort_keys=True)) | |