Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
7-liner: __import__ solution in Clear category for Currency Style by przemyslaw.daniel
def checkio(text):
for i in __import__('re').finditer('\$[.,0-9]*[0-9]', text):
a, b, v = i.start(0), i.end(0), i.group(0)
if __import__('re').search('\.[0-9][0-9][0-9]|,[0-9][0-9]$', v):
s = text[a:b].translate(str.maketrans(',.', '.,'))
text = text[:a]+s+text[b:]
return text
April 16, 2017