Datasets:

Modalities:
Text
Formats:
text
Size:
< 1K
ArXiv:
Libraries:
Datasets
jessezhaoxizhang's picture
Duplicate from jessezhaoxizhang/RepoZero-Py2JS
a839836
Raw
History Blame Contribute Delete
915 Bytes
#!/usr/bin/env python3
import argparse
import canonicaljson
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--a', type=float, required=True)
args = parser.parse_args()
data = args.a
result = canonicaljson.encode_canonical_json(data) # Encode float as canonical JSON
print(result)
if __name__ == "__main__":
main()
# ==================================================
# Sample Test Cases (randomly selected)
# ==================================================
# ===== Test Case 1 =====
# Input:
# --a = -3.14159
# Output:
# b'-3.14159'
# Return Code: 0
# ===== Test Case 2 =====
# Input:
# --a = -1.23456789
# Output:
# b'-1.23456789'
# Return Code: 0
# ===== Test Case 3 =====
# Input:
# --a = -0.001
# Output:
# b'-0.001'
# Return Code: 0
# ===== Test Case 4 =====
# Input:
# --a = 1.23456789
# Output:
# b'1.23456789'
# Return Code: 0