Post History
Python 3.8+, 49 byte lambda c:5**((i:="IVXLCDM".find(c))&1)*10**(i>>1) Testing: f=lambda c:5**((i:="IVXLCDM".find(c))&1)*10**(i>>1) print(*map(f,"IVXLCDM")) 52 bytes M...
#1: Initial revision
# Python 3.8+, 49 byte ```python lambda c:5**((i:="IVXLCDM".find(c))&1)*10**(i>>1) ``` Testing: ```python f=lambda c:5**((i:="IVXLCDM".find(c))&1)*10**(i>>1) print(*map(f,"IVXLCDM")) ``` # 52 bytes My first attempt. Really simple and straight forward. If the rules would allow `1000.0` as result for `M` then it could be written as `1e3`, making this solution one byte smaller. ```python lambda n:[1,5,10,50,100,500,1000]["IVXLCDM".find(n)] ```
