Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 27 additions & 8 deletions bigrandom/answer.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
class BigRandom:
def __init__(self):
self.data = "data.txt"
self.data = 'data.txt'
# add attributes if you need more

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

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

return (noh,suc)
kondisi = False
x = open('data.txt', 'r')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pakai self.data aja

for i in range(10000):
j = x.readline() #52411
noh += j.count("#")
x.close()
kondisi1 = False
x = open('data.txt', 'r')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bedanya sama yang atas apa?

for i in range(10000):
J = x.readline()
for item in J:
if(kondisi1 == True):
suc += ord(item)
if(item == "#"):
kondisi1 = True
x.close()
noh -= 10000 #karena ada 10000 penunjuk baris
print noh
print suc
return (noh, suc)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suc nya masih salah


# add methods if you need more
bigrandom = BigRandom()
bigrandom.answer()