Return to Snippet

Revision: 33640
at October 11, 2010 19:05 by toto898


Initial Code
#1
import string
 
frm = "abcdefghijklmnopqrstuvwxyz"
to = "cdefghijklmnopqrstuvwxyzab"
 
data = """g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp.
        bmgle gr gl zw fylbgq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle.
        sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj."""
 
print string.translate(data, string.maketrans(frm,to))


#2
import string   
    
frm = "abcdefghijklmnopqrstuvwxyz"  
to = "cdefghijklmnopqrstuvwxyzab"  
    
data = """g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp.  
        bmgle gr gl zw fylbgq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle.  
        sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj.""" 

result = ''

for c in data:
    if c in frm:
        result += to[frm.index(c)]
    else:
        result += c

print result


#3
import   string 
s   =   " " 
for   c   in   t   : 
	if   c   in   string.letters   : 
		s   +=   chr((ord(c)   +   2   -   97)   %   26   +   97) 
	else   : 
		s   +=   c 
print   s 
</code>

Initial URL
http://www.pythonchallenge.com/

Initial Description

                                

Initial Title
Python Challenge 1

Initial Tags
python

Initial Language
Python