summaryrefslogtreecommitdiff
path: root/comp/work/54/#hash.py#
diff options
context:
space:
mode:
Diffstat (limited to 'comp/work/54/#hash.py#')
-rw-r--r--comp/work/54/#hash.py#21
1 files changed, 21 insertions, 0 deletions
diff --git a/comp/work/54/#hash.py# b/comp/work/54/#hash.py#
new file mode 100644
index 0000000..ad4859c
--- /dev/null
+++ b/comp/work/54/#hash.py#
@@ -0,0 +1,21 @@
+def hash(string):
+ chunks = []
+ for i in range(0, len(string), 3):
+ tmp = ""
+ for j in range(i, i + 3):
+ try:
+ tmp += string[j]
+ except:
+ break
+ chunks.append(tmp)
+
+ chunks = map(int, chunks)
+
+ print(sum(chunks) % 50)
+
+
+inp = input("input a number: ")
+if (len(inp) <= 10):
+ hash(inp)
+else:
+ print("string is too long")