Advertisement
Centipede18

reverseParenthese

Apr 8th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. def reverseParentheses(s):
  2.     check = True
  3.     while check:
  4.         rb = s[s.rfind("(", 0, s.find(")")) + 1:s.find(")")]
  5.         ra = rb[::-1]
  6.         s = s.replace ("(" +rb+ ")", ra)
  7.         if s.find(")") == -1:
  8.             check = False
  9.     return s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement