Middle three digits: Difference between revisions

Content added Content deleted
m (→‎{{header|Python}}: ( Pruned one unused import ))
m (→‎{{header|Python}}: Adjusted output string)
Line 3,879: Line 3,879:
(
(
justifyRight(mx)(' ')(str(n)) + ' -> ' + (
justifyRight(mx)(' ')(str(n)) + ' -> ' + (
either(str)(str)(mid3digits(n))
either(lambda s: '(' + str(s) + ')')(str)(mid3digits(n))
)
)
) for n in xs
) for n in xs
Line 3,938: Line 3,938:
100 -> 100
100 -> 100
-12345 -> 234
-12345 -> 234
1 -> Less than 3 digits
1 -> (Less than 3 digits)
2 -> Less than 3 digits
2 -> (Less than 3 digits)
-1 -> Less than 3 digits
-1 -> (Less than 3 digits)
-10 -> Less than 3 digits
-10 -> (Less than 3 digits)
2002 -> Even digit count
2002 -> (Even digit count)
-2002 -> Even digit count
-2002 -> (Even digit count)
0 -> Less than 3 digits</pre>
0 -> (Less than 3 digits)</pre>


=={{header|Racket}}==
=={{header|Racket}}==