[Tutor] python challenge 2

Luke Paireepinart rabidpoobear at gmail.com
Tue Jul 18 08:14:19 CEST 2006


devayani barve wrote:
> this is what i did for level 2 of python challenge:
>  
>
> dict={'a':'c','b':'d','c':'e','d':'f','e':'g','f':'h','g':'i','h':'j','i':'k','j':'l','k':'m','l':'n','m':'o','n':'p','o':'q','p':'r','q':'s','r':'t','s':'u','t':'v','u':'w','v':'x','w':'y','x':'z','y':'a','z':'b','.':'.',"'":"'","(":"(",")":")"," 
> ":" "}
>
> s="g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc 
> dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm 
> jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj."
> f=file('book.txt','w')
> f.write(s)
> f.close()
> f=file('book.txt')
> k=[]
> while True:
>     line=f.readline()
>     if len(line)==0:
>         break
>     k=[line]
>     list=[]
>     for elem in k:
>         for c in elem:
>              temp=dict[c]              
>              print dict[c],
>
>  
> And i got this:
>
>  
>
> i   h o p e   y o u   d i d n t   t r a n s l a t e   i t   b y   h a 
> n d .   t h a t s   w h a t   c o m p u t e r s   a r e   f o r .   d 
> o i n g   i t   i n   b y   h a n d   i s   i n e f f i c i e n t   a 
> n d   t h a t ' s   w h y   t h i s   t e x t   i s   s o   l o n g 
> .   u s i n g   s t r i n g . m a k e t r a n s ( )   i s   r e c o m 
> m e n d e d .   n o w   a p p l y   o n   t h e   u r l .
>
>  
>
> I pasted the above text in the url before .html  and got permission 
> denied!!!
>
> is my solution wrong?
>
>   
"apply on the url."
run the previous solution's url through your program.


More information about the Tutor mailing list