字串倒序輸出
顧名思義= =|
# !python3.3def stringReverse(s): """ @param s: string @return: reversed string @example: stringReverse('abc') output cba """ return s[::-1] #start:end:step
凱撒密碼 把字母替換為之後第key個字母,如key=3的話則 a -> d b -> e c -> f ...
# !python3.3def caesarCipher(s, key): """ @param s: text needs encrypt/decrypt @param key: positive if encryption, negative if decryption @return: the encrypted or decrypted text """ import string a = string.ascii_lowercase b = string.ascii_uppercase key = key % 26 #key must be within 0 - 25 ta = a[key:] + a[:key] tb = b[key:] + b[:key] table = s.maketrans(a+b, ta+tb) return s.translate(table)
Bouns
http://www.blisstonia.com/software/WebDecrypto/index.php
只要是替換密碼(就是簡單地把一個字母替換成另一個字母的加密方式),這個網站一定能給你一個美妙的答案 :)
http://www.ssynth.co.uk/~gay/anagram.html
http://wordsmith.org/anagram/
把字母重新組成單詞,例如把 rehipc 重組成 cipher