Click here to Skip to main content
15,396,106 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Coding Challenge Of The Day Pin
wizardzz9-May-12 6:49
Memberwizardzz9-May-12 6:49 
GeneralRe: Coding Challenge Of The Day Pin
Chris Maunder9-May-12 6:58
cofounderChris Maunder9-May-12 6:58 
GeneralRe: Coding Challenge Of The Day Pin
Bassam Abdul-Baki9-May-12 7:06
professionalBassam Abdul-Baki9-May-12 7:06 
GeneralRe: Coding Challenge Of The Day Pin
Sentenryu9-May-12 7:07
MemberSentenryu9-May-12 7:07 
GeneralRe: Coding Challenge Of The Day Pin
Karl Sanford9-May-12 7:17
professionalKarl Sanford9-May-12 7:17 
GeneralRe: Coding Challenge Of The Day Pin
sweavo_new9-May-12 7:40
Membersweavo_new9-May-12 7:40 
GeneralRe: Coding Challenge Of The Day Pin
sweavo_new9-May-12 9:16
Membersweavo_new9-May-12 9:16 
GeneralRe: Coding Challenge Of The Day Pin
yiangos10-May-12 1:45
professionalyiangos10-May-12 1:45 
Or, somewhere in between:
PERL
def a6(roman):
	if len(roman)==0:
		return 0
	mapping={"I":1,"V":5,"X":10,"L":50,"C":100,"D":500,"M":1000}
	values=[mapping[digit] for digit in roman.upper()]
	for i in range(len(values)):
		if i<len(values)-1:
			if values[i]<values[i+1]:
				values[i]=-values[i]
	return sum(values)


also, added capitalization tolerance, so that "MCM" and "mcm" evaluate the same. I haven't added a check that the argument is a valid roman numeral, but that is left as an exercise to the reader Poke tongue | ;-P
Φευ! Εδόμεθα υπό ρηννοσχήμων λύκων!
(Alas! We're devoured by lamb-guised wolves!)

GeneralRe: Coding Challenge Of The Day Pin
jesarg9-May-12 8:56
Memberjesarg9-May-12 8:56 
GeneralRe: Coding Challenge Of The Day Pin
Luc Pattyn9-May-12 19:12
sitebuilderLuc Pattyn9-May-12 19:12 
GeneralRe: Coding Challenge Of The Day Pin
Pascal Ganaye10-May-12 1:53
MemberPascal Ganaye10-May-12 1:53 
GeneralRe: Coding Challenge Of The Day Pin
PIEBALDconsult9-May-12 19:15
professionalPIEBALDconsult9-May-12 19:15 
GeneralRe: Coding Challenge Of The Day Pin
jsc4210-May-12 0:18
professionaljsc4210-May-12 0:18 
GeneralRe: Coding Challenge Of The Day Pin
RobertHarris10-May-12 1:18
MemberRobertHarris10-May-12 1:18 
GeneralRe: Coding Challenge Of The Day Pin
Pascal Ganaye10-May-12 1:52
MemberPascal Ganaye10-May-12 1:52 
GeneralRe: Coding Challenge Of The Day Pin
Luc Pattyn10-May-12 2:12
sitebuilderLuc Pattyn10-May-12 2:12 
GeneralRe: Coding Challenge Of The Day Pin
Pascal Ganaye10-May-12 2:28
MemberPascal Ganaye10-May-12 2:28 
GeneralRe: Coding Challenge Of The Day Pin
Pascal Ganaye10-May-12 2:56
MemberPascal Ganaye10-May-12 2:56 
GeneralRe: Coding Challenge Of The Day Pin
Alan Balkany10-May-12 4:08
MemberAlan Balkany10-May-12 4:08 
GeneralRe: Coding Challenge Of The Day Pin
Reese Currie10-May-12 5:35
MemberReese Currie10-May-12 5:35 
GeneralRe: Coding Challenge Of The Day Pin
AnonimityPreferred10-May-12 6:13
MemberAnonimityPreferred10-May-12 6:13 
GeneralRe: Coding Challenge Of The Day Pin
AnonimityPreferred10-May-12 16:57
MemberAnonimityPreferred10-May-12 16:57 
GeneralRe: Coding Challenge Of The Day Pin
Member 895705310-May-12 7:38
MemberMember 895705310-May-12 7:38 
GeneralRe: Coding Challenge Of The Day Pin
nrkn10-May-12 14:54
Membernrkn10-May-12 14:54 
GeneralRe: Coding Challenge Of The Day Pin
Chris Maunder10-May-12 14:55
cofounderChris Maunder10-May-12 14:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Straw Poll

Do you expect users to read the instructions when using your apps?
  Results   128 votes