Joined
Last Seen
0 Reputation Points
Unknown Quality Score
No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
0 Endorsements
Ranked #72.8K
1 Posted Topic
Re: A quick solution that does both directions: [code=python] # Roman Numerals # 2010-06-15, Eljakim Schrijvers mapping = [ ('cd','cccc'), ('xl','xxxx'),('iv','iiii'),('d','ccccc'),('l','xxxxx'),('v','iiiii'), ('cm','ccccccccc'), ('xc','xxxxxxxxx'),('ix','iiiiiiiii')] mapping.reverse() bignums = [ ('m',1000), ('c',100), ('x', 10), ('i',1) ] def fromroman(x): for (kort, lang) in mapping: x= x.replace(kort, lang) x = '+'.join(list(x)) for (karakter, waarde) in bignums: … |
The End.