Compare commits

...

1 Commits

6 changed files with 50 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
../bitutils.py
+1
View File
@@ -0,0 +1 @@
../divide.py
+1
View File
@@ -0,0 +1 @@
../lib/
+1
View File
@@ -0,0 +1 @@
../multiply.py
+23
View File
@@ -0,0 +1,23 @@
import os
import sys
from divide import divide, table_to_text
print(os.environ, file = sys.stderr)
raw_params = list(map(lambda x: x.split("="), os.environ['QUERY_STRING'].split("&")))
baked_params = {k:v for (k, v) in raw_params}
bp = baked_params
if "x" in bp and "y" in bp and "m" in bp:
x = int("0b" + bp['x'], 2)
y = int("0b" + bp['y'], 2)
m = int(bp['m'])
dt, result = divide(max(list(map(len, [bp['x'], bp['y']]))), x, y, m)
print(f"Content-Type: text/plain; charset=UTF-8\r\n"
f"\r\n"
f"{table_to_text(dt)}\r\n"
f"Result: {result}")
else:
print("Content-Type: text/plain; charset=UTF-8\r\n\r\nCheck your input!")
+23
View File
@@ -0,0 +1,23 @@
import os
import sys
from multiply import multiply, table_to_text
print(os.environ, file = sys.stderr)
raw_params = list(map(lambda x: x.split("="), os.environ['QUERY_STRING'].split("&")))
baked_params = {k:v for (k, v) in raw_params}
bp = baked_params
if "x" in bp and "y" in bp and "m" in bp:
x = int("0b" + bp['x'], 2)
y = int("0b" + bp['y'], 2)
m = int(bp['m'])
dt, result = multiply(max(list(map(len, [bp['x'], bp['y']]))), x, y, m)
print(f"Content-Type: text/plain; charset=UTF-8\r\n"
f"\r\n"
f"{table_to_text(dt)}\r\n"
f"Result: {result}")
else:
print("Content-Type: text/plain; charset=UTF-8\r\n\r\nCheck your input!")