-
Notifications
You must be signed in to change notification settings - Fork 23
Maaf kak telat:( #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Maaf kak telat:( #16
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,36 @@ | ||
| class BigRandom: | ||
| def __init__(self): | ||
| self.data = "data.txt" | ||
| <<<<<<< HEAD | ||
|
|
||
|
|
||
| def answer(self): | ||
| noh = 0 | ||
| suc = 0 | ||
| a = open("data.txt","r") | ||
| s=0 | ||
| for x in a : | ||
| s+=1 | ||
| t=0 | ||
| tmp=0 | ||
| for y in x: | ||
| t+=1 | ||
| for z in y: | ||
| if (t == 1 and z != "#"): | ||
| tmp += ord(z) | ||
| if (z=="#"): | ||
| noh +=1 | ||
| else : | ||
| suc += ord(z) | ||
| if (t==1): | ||
| suc-=tmp | ||
| a.close() | ||
| noh -= s | ||
| return (noh,suc) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suc nya masih salah
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sucnya masih salah, yang bener 393754393 |
||
|
|
||
| b= BigRandom() | ||
| print (b.answer()) | ||
| ======= | ||
| # add attributes if you need more | ||
|
|
||
| def answer(self): | ||
|
|
@@ -13,4 +43,5 @@ def answer(self): | |
|
|
||
| return (noh,suc) | ||
|
|
||
| # add methods if you need more | ||
| # add methods if you need more | ||
| >>>>>>> 64e1f92e25e7147b206ac73695e846881e7f9b0d | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,25 @@ | ||
| class Caesar: | ||
| def __init__(self): | ||
| self.ciphertext = "ciphertext.txt" | ||
| <<<<<<< HEAD | ||
|
|
||
|
|
||
| def answer(self): | ||
| key = 46 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tau 46 dari mana mas? Kan soalnya suruh bikin algoritma buat nyari 46
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. coba cek soalnya lagi deh, kan suruh bikin algoritma buat nyari key. Ini 46 tau dari mana? |
||
| a = open("ciphertext.txt","r") | ||
| x ="" | ||
| for i in a: | ||
| for y in i: | ||
| tmp = ord(str(y))-key | ||
| if (tmp<0): | ||
| tmp += 127 | ||
| x += chr(tmp) | ||
| print (x) | ||
| return (key) | ||
|
|
||
| b= Caesar() | ||
| print (b.answer()) | ||
| ======= | ||
| # add attributes if you need more | ||
|
|
||
| def answer(self): | ||
|
|
@@ -10,4 +29,5 @@ def answer(self): | |
|
|
||
| return (key) | ||
|
|
||
| # add methods if you need more | ||
| # add methods if you need more | ||
| >>>>>>> 64e1f92e25e7147b206ac73695e846881e7f9b0d | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pakai self.data aja
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dan nama variabelnya ga ada yang lebih bagus kah?