Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ! is negation, & is conjunction , / is disjunction , = is equivalence , > is implication
- #((PQ)/S)=T)
- v = input("enter your expression below: ")
- empty = []
- connections="!&/>="
- def funct1(w, pos):
- if pos>=len(v):
- return
- if(v[pos].isalpha()==True or connections.find(v[pos])!=-1):
- w.append(v[pos])
- funct1(w, pos + 1)
- elif(v[pos]=='('):
- new=[]
- w.append(new)
- funct1(new,pos+1)
- elif(v[pos]==')'):
- funct1(w, pos + 1)
- funct1(empty,0)
- print (empty)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement