summaryrefslogtreecommitdiff
path: root/comp/work/54/hash.py
diff options
context:
space:
mode:
authorthing1 <thing1@seacrossedlovers.xyz>2025-04-02 10:26:21 +0000
committerthing1 <thing1@seacrossedlovers.xyz>2025-04-02 10:26:21 +0000
commitfef6d2cc76518eee75fc0d95e765bd2be8a660ee (patch)
treed9886424f7d18d86ad1f4c73613b7e23b64b0434 /comp/work/54/hash.py
parent5b73c7157aad4d65eee7af41fd4b4ded1a434b96 (diff)
did comp sci and some electronics
Diffstat (limited to 'comp/work/54/hash.py')
-rw-r--r--comp/work/54/hash.py21
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..6fae0ec
--- /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")