Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. list_index_deg = []
  2. for i in range(len(str) ):
  3. if str[i] == '^':
  4. list_index_deg.append(i)
  5.  
  6.  
  7. for index in list_index_deg:
  8. if str[index - 1].islower():
  9. expression = str[index - 1]
  10. if str[index - 1] == ')':
  11. count = 0
  12. expression = ''
  13. copy_index = index
  14. while count >= 0 and copy_index >= 0:
  15. if str[copy_index] == ')':
  16. count += 1
  17. if str[copy_index] == '(':
  18. count -= 1
  19. expression = str[copy_index] + expression
  20. copy_index -= 1
  21. expression = expression[:-1]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement