Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def fn(thing):
- #thing = thing[1:]
- #print(thing)
- final_stack = ["this is final stack"]
- index = 0
- strlen = len(thing)
- shape_stack = []
- #while index < strlen:
- for x in thing:
- count = 0
- if thing[index] == "(":
- count = count + 1
- shape_stack.append(thing[index])
- index = index + 1
- #return count
- elif thing[index] == ")":
- count = count - 1
- print(count)
- shape_stack.append(thing[index])
- index = index + 1
- if count == 0:
- print ("this is the break between shapes", shape_stack)
- final_stack.append(shape_stack)
- break
- else:
- pass
- else:
- shape_stack.append(thing[index])
- print(shape_stack)
- index = index + 1
- #this is where break goes
- return final_stack
- #open_bracket = ["("]
- #shape_stack = open_bracket + shape_stack
- hi = fn(inputparsed)
- print (hi)
Add Comment
Please, Sign In to add comment