CREATE EXTENSION plpython3u; CREATE OR REPLACE FUNCTION caesarCipher(realtext text, step int) RETURNS TEXT AS $$ outText = [] cryptText = [] uppercase = ['A', 'B', 'C', 'Ç', 'D', 'E', 'F', 'G', 'Ğ', 'H', 'I', 'İ', 'J', 'K', 'L', 'M', 'N', 'O', 'Ö', 'P', 'Q', 'R', 'S', 'Ş', 'T', 'U', 'Ü', 'V', 'W', 'X', 'Y', 'Z'] lowercase = ['a', 'b', 'c', 'ç', 'd', 'e', 'f', 'g', 'ğ', 'h', 'ı', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'ö', 'p', 'q', 'r', 's', 'ş', 't', 'u', 'ü', 'v', 'w', 'x', 'y', 'z'] for eachLetter in realtext: if eachLetter in uppercase: index = uppercase.index(eachLetter) crypting = (index + step) % 32 cryptText.append(crypting) newLetter = uppercase[crypting] outText.append(newLetter) elif eachLetter in lowercase: index = lowercase.index(eachLetter) crypting = (index + step) % 32 cryptText.append(crypting) newLetter = lowercase[crypting] outText.append(newLetter) elif eachLetter == ' ': outText.append(' ') elif eachLetter == '.': outText.append('.') listToStr = ''.join([str(elem) for elem in outText]) return listToStr $$LANGUAGE 'plpython3u'; select caesarCipher('MOBİLYA VE',3)