na try ko na po siya. ganito po ba?You do not have permission to view the full content of this post. Log in or register now.
na try ko na po siya. ganito po ba?
View attachment 2231558
>>> x = 'D / )C * B + A('
>>> y = x.replace(')', '(')[:-1] + ')'
>>> y
'D / (C * B + A)'
Hello sir! Ask ko lang po kung ito po ung ginamit niyo [:-1] para ma remove ung last char?First, replace the first parenthesis then remove the last char then append closing parenthesis
Code:>>> x = 'D / )C * B + A(' >>> y = x.replace(')', '(')[:-1] + ')' >>> y 'D / (C * B + A)'