Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
re (sub, fullmatch), translate/maketrans for exchange ',' and '.' solution in Clear category for Currency Style by Phil15
from re import sub, fullmatch
def checkio(text):
def repl(m):
if fullmatch(r'\$\d{1,3}(\.\d{3})*(\,\d{2})?', m.group()): # Euro Style
return m.group().translate(str.maketrans(',.','.,')) # ',' <--> '.'
return m.group() # US Style: no change to do.
return sub(r'\$[\d.,]*\d', repl, text) # dollars
Sept. 15, 2018
Comments: