From 97f12cf64c2ad2e3cbf4ad199695ad0c702652b7 Mon Sep 17 00:00:00 2001 From: nafasamuth Date: Wed, 22 Feb 2017 01:10:34 +0800 Subject: [PATCH 1/5] masih banyak ya, semangat :) --- .idea/internship-basic-gen3.iml | 11 + .idea/misc.xml | 4 + .idea/modules.xml | 8 + .idea/vcs.xml | 6 + .idea/workspace.xml | 367 ++++++++++++++++++++++++++++ bigrandom/.idea/bigrandom.iml | 11 + bigrandom/.idea/misc.xml | 14 ++ bigrandom/.idea/modules.xml | 8 + bigrandom/.idea/workspace.xml | 420 ++++++++++++++++++++++++++++++++ bigrandom/answer.py | 16 +- bigrandom/lanjutan | 29 +++ 11 files changed, 892 insertions(+), 2 deletions(-) create mode 100644 .idea/internship-basic-gen3.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml create mode 100644 bigrandom/.idea/bigrandom.iml create mode 100644 bigrandom/.idea/misc.xml create mode 100644 bigrandom/.idea/modules.xml create mode 100644 bigrandom/.idea/workspace.xml create mode 100644 bigrandom/lanjutan diff --git a/.idea/internship-basic-gen3.iml b/.idea/internship-basic-gen3.iml new file mode 100644 index 0000000..6711606 --- /dev/null +++ b/.idea/internship-basic-gen3.iml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..15bd046 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..645787b --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..2d880e9 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,367 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1487684938016 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bigrandom/.idea/bigrandom.iml b/bigrandom/.idea/bigrandom.iml new file mode 100644 index 0000000..6711606 --- /dev/null +++ b/bigrandom/.idea/bigrandom.iml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/bigrandom/.idea/misc.xml b/bigrandom/.idea/misc.xml new file mode 100644 index 0000000..26dafb9 --- /dev/null +++ b/bigrandom/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bigrandom/.idea/modules.xml b/bigrandom/.idea/modules.xml new file mode 100644 index 0000000..c3d5fa0 --- /dev/null +++ b/bigrandom/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/bigrandom/.idea/workspace.xml b/bigrandom/.idea/workspace.xml new file mode 100644 index 0000000..84416ab --- /dev/null +++ b/bigrandom/.idea/workspace.xml @@ -0,0 +1,420 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1487682653361 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bigrandom/answer.py b/bigrandom/answer.py index cb5fee4..cafb8b7 100644 --- a/bigrandom/answer.py +++ b/bigrandom/answer.py @@ -1,6 +1,6 @@ class BigRandom: def __init__(self): - self.data = "data.txt" + self.data = open("data.txt", "r") # add attributes if you need more def answer(self): @@ -10,7 +10,19 @@ def answer(self): # ommiting line number and its hashtag # your algorithm - + for each in b.data: + c = each + for x in c: + c = c[1:] + if (x == "#"): + noh += 1 + break + for x in c: + suc += ord(x) return (noh,suc) + +b = BigRandom() +print (b.answer()) + # add methods if you need more \ No newline at end of file diff --git a/bigrandom/lanjutan b/bigrandom/lanjutan new file mode 100644 index 0000000..9f3eb86 --- /dev/null +++ b/bigrandom/lanjutan @@ -0,0 +1,29 @@ +class BigRandom: + def __init__(self): + self.data = open("data.txt", "r") + # add attributes if you need more + + @property + def answer(self): + noh = 0 # variable to store number of hashtag + # ommiting line number's hashtag + suc = 0 # variable to store sum of character's code in ascii, + # ommiting line number and its hashtag + + # your algorithm + for each in b.data: + c = each + for x in c: + c = c[1:] + if (x == "#"): + noh = char(#) + break + for x in c: + suc += ord(x) + return (noh,suc) + + +b = BigRandom() +print (b.answer) + + # add methods if you need more \ No newline at end of file From 865cf1c8fe0341da35b178900ea36168e2f8090d Mon Sep 17 00:00:00 2001 From: nafasamuth Date: Wed, 22 Feb 2017 01:37:23 +0800 Subject: [PATCH 2/5] alhamdulillah kurang 1 soal --- .idea/workspace.xml | 125 ++++++++++++++++++++++------ bigrandom/{lanjutan => lanjutan.py} | 3 +- 2 files changed, 102 insertions(+), 26 deletions(-) rename bigrandom/{lanjutan => lanjutan.py} (92%) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 2d880e9..dc970ef 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,8 +2,8 @@ - - + + - + - + - - + + - - + + @@ -60,6 +60,13 @@ + + + @@ -67,6 +74,7 @@ @@ -126,7 +134,7 @@ - + + + - + + - - + + + @@ -304,22 +331,22 @@ - + - - - - + + + + - - + + - - + + @@ -331,6 +358,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -347,18 +406,34 @@ + + + + + + + + - + - + + + + + + + + + - - + + diff --git a/bigrandom/lanjutan b/bigrandom/lanjutan.py similarity index 92% rename from bigrandom/lanjutan rename to bigrandom/lanjutan.py index 9f3eb86..f44f26a 100644 --- a/bigrandom/lanjutan +++ b/bigrandom/lanjutan.py @@ -16,9 +16,10 @@ def answer(self): for x in c: c = c[1:] if (x == "#"): - noh = char(#) break for x in c: + if (x == "#"): + noh += 1 suc += ord(x) return (noh,suc) From ecce9ded2b09d64b4687f3c8a7929d85a102b8ff Mon Sep 17 00:00:00 2001 From: nafasamuth Date: Fri, 24 Feb 2017 14:32:27 +0800 Subject: [PATCH 3/5] Nafasa --- .idea/workspace.xml | 231 ++++++++++++++++++++++++++++------ bigrandom/.idea/workspace.xml | 91 +++++++++++--- bigrandom/answer.py | 6 +- bigrandom/lanjutan.py | 30 ----- caesar/answer.py | 20 ++- 5 files changed, 282 insertions(+), 96 deletions(-) delete mode 100644 bigrandom/lanjutan.py diff --git a/.idea/workspace.xml b/.idea/workspace.xml index dc970ef..460eb18 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,8 +2,11 @@ - - + + + + + @@ -73,15 +86,16 @@ - @@ -99,6 +113,8 @@ + + @@ -111,6 +127,20 @@ + + + + + + + + - - - + + + - + + - - + + + @@ -328,17 +375,17 @@ - + - + - - + + - + @@ -354,19 +401,37 @@ - + + - - + + - + + + + + + + + + + + + + + + + + @@ -374,6 +439,23 @@ + + + + + + + + + + + + + + + + + @@ -386,11 +468,17 @@ - - + + + + + + + + @@ -398,6 +486,29 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -406,34 +517,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + + + + + + + + + - + - - + + diff --git a/bigrandom/.idea/workspace.xml b/bigrandom/.idea/workspace.xml index 84416ab..62d3312 100644 --- a/bigrandom/.idea/workspace.xml +++ b/bigrandom/.idea/workspace.xml @@ -30,21 +30,21 @@ - + - + - - + + - - + + @@ -67,6 +67,7 @@ @@ -101,7 +102,6 @@ - @@ -123,12 +123,13 @@ + - + - + + + - + + - - - + + + + @@ -360,6 +380,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -400,18 +452,19 @@ - + + - - + + - + - - + + diff --git a/bigrandom/answer.py b/bigrandom/answer.py index cafb8b7..f44f26a 100644 --- a/bigrandom/answer.py +++ b/bigrandom/answer.py @@ -3,6 +3,7 @@ def __init__(self): self.data = open("data.txt", "r") # add attributes if you need more + @property def answer(self): noh = 0 # variable to store number of hashtag # ommiting line number's hashtag @@ -15,14 +16,15 @@ def answer(self): for x in c: c = c[1:] if (x == "#"): - noh += 1 break for x in c: + if (x == "#"): + noh += 1 suc += ord(x) return (noh,suc) b = BigRandom() -print (b.answer()) +print (b.answer) # add methods if you need more \ No newline at end of file diff --git a/bigrandom/lanjutan.py b/bigrandom/lanjutan.py deleted file mode 100644 index f44f26a..0000000 --- a/bigrandom/lanjutan.py +++ /dev/null @@ -1,30 +0,0 @@ -class BigRandom: - def __init__(self): - self.data = open("data.txt", "r") - # add attributes if you need more - - @property - def answer(self): - noh = 0 # variable to store number of hashtag - # ommiting line number's hashtag - suc = 0 # variable to store sum of character's code in ascii, - # ommiting line number and its hashtag - - # your algorithm - for each in b.data: - c = each - for x in c: - c = c[1:] - if (x == "#"): - break - for x in c: - if (x == "#"): - noh += 1 - suc += ord(x) - return (noh,suc) - - -b = BigRandom() -print (b.answer) - - # add methods if you need more \ No newline at end of file diff --git a/caesar/answer.py b/caesar/answer.py index 0d85db4..b322b30 100644 --- a/caesar/answer.py +++ b/caesar/answer.py @@ -1,13 +1,25 @@ class Caesar: def __init__(self): - self.ciphertext = "ciphertext.txt" + self.ciphertext = open("ciphertext.txt","r") # add attributes if you need more + @property def answer(self): key = 0 # variable to store the key # your algorithm - - return (key) - + b = False + while not b: + to_find = "xxx" + a = [] + for i in c.ciphertext: + d = chr(int((ord(i)+key)%127)) + a.append(d) + c.f = "".join(a) + if to_find in c.ciphertext: + b = True + return (key) + key +=1 +c = Caesar() +print (c.answer()) # add methods if you need more \ No newline at end of file From daf14c8ae57f756c9b02e990c5e19261884e353d Mon Sep 17 00:00:00 2001 From: nafasamuth Date: Sun, 26 Feb 2017 20:55:15 +0800 Subject: [PATCH 4/5] Nafasa --- .idea/workspace.xml | 103 +++++++++++-------- bigrandom/.idea/misc.xml | 10 -- bigrandom/.idea/workspace.xml | 179 +++++++++++++++++++--------------- caesar/answer.py | 31 +++--- 4 files changed, 181 insertions(+), 142 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 460eb18..25079ba 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,10 +2,9 @@ - + - - + - + - + @@ -380,10 +363,10 @@ - + - - + + @@ -391,80 +374,120 @@ - + + + + + + + + + - + - - + + + + + + + + + + + + + + + + - - + - - + - - + + - - + + + + + + + + + + + + + + + - - + - + - - - + + - + + - - + + - + + + + + + + + + - - + + diff --git a/caesar/answer.py b/caesar/answer.py index b322b30..bde1509 100644 --- a/caesar/answer.py +++ b/caesar/answer.py @@ -1,25 +1,24 @@ class Caesar: def __init__(self): - self.ciphertext = open("ciphertext.txt","r") + self.ciphertext = "ciphertext.txt" # add attributes if you need more - @property def answer(self): key = 0 # variable to store the key # your algorithm - b = False - while not b: - to_find = "xxx" - a = [] - for i in c.ciphertext: - d = chr(int((ord(i)+key)%127)) - a.append(d) - c.f = "".join(a) - if to_find in c.ciphertext: - b = True - return (key) - key +=1 + a = open(self.ciphertext, "r") + b = "" + key = 46 + n = 0 + for x in a.read(): + n = ord(str(x))- key + if (n<0): + n += 127 + b += chr(n) + print(b) + return(key) + + # add methods if you need more c = Caesar() -print (c.answer()) - # add methods if you need more \ No newline at end of file +print (c.answer()) \ No newline at end of file From 6dff2581f7df6c090038e93e57212d0756e12da4 Mon Sep 17 00:00:00 2001 From: nafasamuth Date: Mon, 27 Feb 2017 19:57:29 +0800 Subject: [PATCH 5/5] bigrandom --- .idea/workspace.xml | 136 ++++++++++++++++++++++------------ bigrandom/.idea/workspace.xml | 116 ++++++++++++++++++++++++----- bigrandom/answer.py | 11 ++- caesar/answer.py | 1 - 4 files changed, 190 insertions(+), 74 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 25079ba..2ccfa6b 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,8 +3,8 @@ - + - + @@ -377,12 +357,12 @@ - + - + @@ -395,6 +375,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -559,13 +598,6 @@ - - - - - - - @@ -582,14 +614,6 @@ - - - - - - - - @@ -606,10 +630,26 @@ + + + + + + + + + + + + + + + + - - + + diff --git a/bigrandom/.idea/workspace.xml b/bigrandom/.idea/workspace.xml index d13c391..dec5cba 100644 --- a/bigrandom/.idea/workspace.xml +++ b/bigrandom/.idea/workspace.xml @@ -22,9 +22,19 @@ + + + + + + + + + + - + @@ -33,7 +43,7 @@ - + @@ -45,17 +55,17 @@ - @@ -72,7 +82,6 @@ - @@ -87,6 +96,7 @@ + @@ -325,26 +335,26 @@ - - + + - + - - + + @@ -363,7 +373,7 @@ - + @@ -371,6 +381,22 @@ + + + + + + + + + + + + + + + + @@ -379,7 +405,23 @@ - + + + + + + + + + + + + + + + + + @@ -387,7 +429,22 @@ + + + + + + + + + + + + + + + @@ -395,6 +452,20 @@ + + + + + + + + + + + + + + @@ -472,22 +543,29 @@ - - + - + - + + + + + + + + + diff --git a/bigrandom/answer.py b/bigrandom/answer.py index f44f26a..897b7e6 100644 --- a/bigrandom/answer.py +++ b/bigrandom/answer.py @@ -1,9 +1,8 @@ class BigRandom: def __init__(self): - self.data = open("data.txt", "r") + self.data = "data.txt" # add attributes if you need more - @property def answer(self): noh = 0 # variable to store number of hashtag # ommiting line number's hashtag @@ -11,8 +10,8 @@ def answer(self): # ommiting line number and its hashtag # your algorithm - for each in b.data: - c = each + d = open(self.data, "r") + for c in d: for x in c: c = c[1:] if (x == "#"): @@ -24,7 +23,7 @@ def answer(self): return (noh,suc) -b = BigRandom() -print (b.answer) +d = BigRandom() +print (d.answer()) # add methods if you need more \ No newline at end of file diff --git a/caesar/answer.py b/caesar/answer.py index bde1509..4bfcaca 100644 --- a/caesar/answer.py +++ b/caesar/answer.py @@ -9,7 +9,6 @@ def answer(self): # your algorithm a = open(self.ciphertext, "r") b = "" - key = 46 n = 0 for x in a.read(): n = ord(str(x))- key