Skip to content

Instantly share code, notes, and snippets.

View bmarchenko's full-sized avatar

Bohdan Marchenko bmarchenko

View GitHub Profile
@bmarchenko
bmarchenko / ascitree
Last active February 21, 2018 00:00
NLP test 1
def ascitree(line):
#split to list of words
line = line.split(" ")
cur_indent = []
#the very first(root) is an exception
print line.pop(0).replace("(", "")
#loop over the rest, checking for brackets as levels indicators
for i in line:
out = " {}+---{}".format("".join(cur_indent), i.replace(")", "").replace("(", "").strip())
if len(cur_indent) > 0:
@bmarchenko
bmarchenko / factorial.py
Created November 27, 2012 14:27 — forked from ghoseb/factorial.py
The evolution of a Python Programmer
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
@bmarchenko
bmarchenko / factorial.py
Created November 27, 2012 14:27 — forked from ghoseb/factorial.py
The evolution of a Python Programmer
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal