msg = "MONCOURSPREFERE"
def to_int(c):
    return ord(c) - ord('A')

def to_chr(x):
    return chr(ord('A') + x)

def cipher(st):
    res = ""
    for c in st:
        pos = to_int(c)
        x = (9 * pos + 5) % 26
        s = to_chr(x)
        res += s
    return res

def decode(st):
    res = ""
    for c in st:
        pos = to_int(c)
        x = (3 * pos + 11) % 26
        s = to_chr(x)
        res += s
    return res
print(cipher(msg))
secret = "JBSXBDCLKCPYPCP"
print(decode(secret))

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: