if !=none and !''if in 'cm ''cd ''xc ''xl ''ix ''iv ']sum+= [xelif [ in 'mdclxvi 'sum+= [ [ ]]*len(xprint(sumenter roman numeralmcmxvii the regular expression itself is fairly straightforward it looks for up to three 'sfollowed by zero or one cm'sfollowed by zero or one cd'setc and stores each of those in group the for loop then reads through those groups and uses dictionary to add the appropriate values to running sum dates here we use regular expression to take date in verbose formatlike february and convert it an abbreviated formatmm/dd/yy (with no leading zeroesrather than depend on the user to enter the date in exactly the right waywe can use regular expression to allow for variation and mistakes for instancethis program will work whether the user spells out the whole month name or abbreviates it (with or with periodcapitalization does not matterand it also does not matter if they can even spell the month name correctly they just have to get the first three letters correct it also does not matter how much space they use and whether or not they use comma after the day import re 'jan '' ''feb '' ''mar '' ''apr '' ''may '' ''jun '' ''jul '' ''aug '' ''sep '' ''oct '' ''nov '' ''dec '' 'date input'enter date' re match'([ -za- ]+)?\ *(\ { , }),?\ *(\ { }'dateprint'{}/{}/{format( [ group( lower()[: ]] group( ) group( )[- :])enter datefeb the first part of the regular expression([ -za- ]+)takes care of the month name it matches however many letters the user gives for the month name the matches either or periods after the month nameso the user can either enter period or not the parentheses around the letters save the result in group next we find the day\ *(\ { , }the first part \smatches zero or more whitespace charactersso it doesn' matter how much space the user puts between the month and day the rest matches one or two digits and saves it in group