Last active
December 20, 2015 04:09
-
-
Save icyflame/6068542 to your computer and use it in GitHub Desktop.
This is the code that I used to solve the third problem in the weekly problem set on brilliant.org
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def removeSpace(): | |
p = '' | |
filin = open("pi.txt") | |
for y in filin: | |
for i in y : | |
if not i == '\n': | |
if not i == ' ': | |
p += i | |
filin.close() | |
return p | |
def piTest(): | |
done = [] | |
p = removeSpace() | |
counter = 1 | |
for i in range(len(p)): | |
flag = True | |
if i == len(p) - 1: | |
break | |
while flag: | |
if p[i] == p[i+counter]: | |
counter += 1 | |
else: | |
if counter> 1: | |
done.append(counter) | |
counter = 1 | |
flag = False | |
return done | |
print "Reqd value is:", max(piTest()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment