Skip to content

Instantly share code, notes, and snippets.

@icyflame
Last active December 20, 2015 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icyflame/6068542 to your computer and use it in GitHub Desktop.
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
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