-
Notifications
You must be signed in to change notification settings - Fork 0
/
depth.py
40 lines (33 loc) · 811 Bytes
/
depth.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#The expression depth counter for GUISE Symblint Package
#Lynch Research Corp.
import numpy as np
def depth_count():
ops = ['+','-','*','/','^']
parantheses=['(',')']
input = raw_input('*')
j=0
k=0
l=0
processed = np.chararray((len(input),1))
oplist = []
parlist = []
for e in input:
if e in ops:
oplist.append(e)
processed[j,0]=k
k = k + 1
else:
if e in parantheses:
oplist.append(0)
parlist.append(e)
processed[j,0]=l
l = l + 1
else:
processed[j,0]=e
j=j+1
print processed
print oplist
print parlist
return k
while(1):
print depth_count()