broke the evaluation environment
I would like to give some feedback about ...
From: http://www.checkio.org/mission/pep8-break/solve/
HTTP\_USER\_AGENT:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36
My Code:
import math ,re;
def twist ( t , r = "" , w = "" , p = None ) :#
a , A ,b,B = ( "abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ", \
"0123456789,!({[<@;.?)}]>#:", "9876543210.?)}]>#:,!({[<@;");0#
d=dict ( zip ( a+A+b , A+a+B) );m=lambda x : x if not x in d else d.get ( x )
#plop
for c in t:#
if c.isalpha ( )==True:p,w=( True ,
( w if ( not p is None ) else "" )+`c`[ 1 ] );3#
else:p,r=( None, ( r+"".join ( reversed( w ) ) if p else r)+c);4#
if p!=None:r+="".join ( reversed ( w ) );5#
return " ".join ( "".join ( [ m ( c ) for c in r ] ).split ( ) );#
works perfectly fine when I "try it"
twist("Hello World!") gives the right result ("OLLEh DLROw?")
But the validation process pretends that:
Your result: "''''' '''''?"
Right result: "OLLEh DLROw?"
Fail: twist("Hello World!")
Yes, I know, that code looks like crap :D
From: http://www.checkio.org/mission/pep8-break/solve/
HTTP\_USER\_AGENT:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36
My Code:
import math ,re;
def twist ( t , r = "" , w = "" , p = None ) :#
a , A ,b,B = ( "abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ", \
"0123456789,!({[<@;.?)}]>#:", "9876543210.?)}]>#:,!({[<@;");0#
d=dict ( zip ( a+A+b , A+a+B) );m=lambda x : x if not x in d else d.get ( x )
#plop
for c in t:#
if c.isalpha ( )==True:p,w=( True ,
( w if ( not p is None ) else "" )+`c`[ 1 ] );3#
else:p,r=( None, ( r+"".join ( reversed( w ) ) if p else r)+c);4#
if p!=None:r+="".join ( reversed ( w ) );5#
return " ".join ( "".join ( [ m ( c ) for c in r ] ).split ( ) );#
works perfectly fine when I "try it"
twist("Hello World!") gives the right result ("OLLEh DLROw?")
But the validation process pretends that:
Your result: "''''' '''''?"
Right result: "OLLEh DLROw?"
Fail: twist("Hello World!")
Yes, I know, that code looks like crap :D