Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- list_index_deg = []
- for i in range(len(str)):
- if str[i] == '^':
- list_index_deg.append(i)
- for index in list_index_deg:
- if str[index - 1].islower():
- expression = str[index - 1]
- if str[index - 1] == ')':
- count = 1
- expression = ''
- copy_index = index-1
- while count > 0 and copy_index >= 0:
- if str[copy_index] == ')':
- count += 1
- if str[copy_index] == '(':
- count -= 1
- expression = str[copy_index] + expression
- copy_index -= 1
- print(expression)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement