Advertisement
Guest User

Untitled

a guest
Dec 11th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. line = 'a*(b+c*-a)*0%d'
  2. signs = {'*' : ' and ',
  3.          '+' : ' or ',
  4.          '-' : ' not ',
  5.          '%' : ' | '}
  6. a = 1
  7. b = 0
  8. c = 1
  9. d = 1
  10. fline = ''
  11. for ch in line:
  12.     if ch in signs:
  13.         ch = signs[ch]
  14.     fline+=ch
  15.  
  16. print(eval(fline))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement