From eb58d334cef6844b246fa3e74e826e67988b4a42 Mon Sep 17 00:00:00 2001 From: Mohamad Irwan Afandi Date: Thu, 23 Feb 2017 21:44:50 +0700 Subject: [PATCH 1/5] Big Random - But not like the result Masih bingung cara akses tiap baris, dan juga penanda --- bigrandom/answer.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/bigrandom/answer.py b/bigrandom/answer.py index cb5fee4..b667415 100644 --- a/bigrandom/answer.py +++ b/bigrandom/answer.py @@ -10,7 +10,20 @@ def answer(self): # ommiting line number and its hashtag # your algorithm + my_file = open ("ok.txt", "r") + for a in my_file: + for b in a: + pagar = 0 + for c in b: + if (c=="#"): + noh = noh+1 + else: + suc += ord(c) + my_file.close() + return (noh-10000,suc) + +ok = BigRandom() +print(ok.answer()) + - return (noh,suc) - - # add methods if you need more \ No newline at end of file + # add methods if you need more From bef18d40d4b58fc207b7f6086f72d5159a6ece9d Mon Sep 17 00:00:00 2001 From: Mohamad Irwan Afandi Date: Fri, 24 Feb 2017 13:51:42 +0700 Subject: [PATCH 2/5] M. Irwan Afandi RandomBignya mungkin gini dah --- bigrandom/answer.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/bigrandom/answer.py b/bigrandom/answer.py index b667415..21ea2ac 100644 --- a/bigrandom/answer.py +++ b/bigrandom/answer.py @@ -10,18 +10,19 @@ def answer(self): # ommiting line number and its hashtag # your algorithm - my_file = open ("ok.txt", "r") - for a in my_file: - for b in a: - pagar = 0 - for c in b: - if (c=="#"): - noh = noh+1 - else: - suc += ord(c) + my_file = open ("ok.txt", "r") + for num in my_file: #masuk num berisi semua data myfile + while (num[0] != "#"): #baca sampek ketemu pagar pertama + num = num[1:] #sama seperti num++ + num = num [1:] #pagar pertama diloncati / tidak dibaca -> pindah karakter setelah pagar + for line in num: #baca perbaris + if (line =="#"): #cek kondisi kalau pagar tambah saja 1 pagarnya + noh +=1 + suc += ord(line) #penambahan karakter setelah pagar pertama my_file.close() - return (noh-10000,suc) - + return (noh,suc) + + ok = BigRandom() print(ok.answer()) From 780f8fcb92c529ee56831d959f6ea150e2210ce2 Mon Sep 17 00:00:00 2001 From: Mohamad Irwan Afandi Date: Fri, 24 Feb 2017 14:28:56 +0700 Subject: [PATCH 3/5] Irwan Caesar Mungkin yang bingung kalok tidak dicoba 1 by 1, bagamiana itu nentuin encrip kode ke berapa --- caesar/answer.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/caesar/answer.py b/caesar/answer.py index 0d85db4..aeea7b0 100644 --- a/caesar/answer.py +++ b/caesar/answer.py @@ -7,7 +7,21 @@ def answer(self): key = 0 # variable to store the key # your algorithm - + my_file = open (self.ciphertext,"r"); + key = 46 #coba-coba + tmp = "" #penampung dari tiap huruf nanti + for x in my_file.read(): #akes perhuruf + index = 0 #penampung tiap karakter itu ascii berapa + index = ord(x)-key #mis decode 5 maka A = 1+5 = 6 => F, biar balik lagi kurang dengan key + if (index<0): #Z misal 26 + 5 maka balik ke 5, biar ke 26 lagi dikurang key ditambah keseluruhan + index += 127 + tmp += chr(index) #tiap karakter ditampung di sini + print (tmp) + print ("\nEnkrip yang digunakan: ", key) return (key) + my_file.close() +hasil = Caesar() +hasil.answer() + - # add methods if you need more \ No newline at end of file + # add methods if you need more From 39bc6c1b6b42701ba1b43cbab2448a43542ce807 Mon Sep 17 00:00:00 2001 From: Mohamad Irwan Afandi Date: Fri, 24 Feb 2017 14:30:29 +0700 Subject: [PATCH 4/5] Irwan Last ok --- bigrandom/answer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigrandom/answer.py b/bigrandom/answer.py index 21ea2ac..879c491 100644 --- a/bigrandom/answer.py +++ b/bigrandom/answer.py @@ -10,7 +10,7 @@ def answer(self): # ommiting line number and its hashtag # your algorithm - my_file = open ("ok.txt", "r") + my_file = open (self.data, "r") for num in my_file: #masuk num berisi semua data myfile while (num[0] != "#"): #baca sampek ketemu pagar pertama num = num[1:] #sama seperti num++ From b7dad0e18406d93d3a709cb04037e86f02da2c2f Mon Sep 17 00:00:00 2001 From: Mohamad Irwan Afandi Date: Mon, 27 Feb 2017 13:01:51 +0700 Subject: [PATCH 5/5] update caesar update data caesar --- caesar/answer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/caesar/answer.py b/caesar/answer.py index aeea7b0..8005a9e 100644 --- a/caesar/answer.py +++ b/caesar/answer.py @@ -18,8 +18,9 @@ def answer(self): tmp += chr(index) #tiap karakter ditampung di sini print (tmp) print ("\nEnkrip yang digunakan: ", key) - return (key) my_file.close() + return (key) + hasil = Caesar() hasil.answer()