Python Program to input any string and make it the encrypt code by 2 charactern


s= input ('Enter a string')

x=''

len = len(string)

for i in range (len):

    ch = string[i]

    if (ch=='y'):

        x=x+'a'

    elif (ch=='z'):

        x=x+'b'

    elif (ch=='Y'):

        x=x+'A'

    elif (ch=='Z'):

        x=x+'B'

    else :

        a = ord(ch) + 2

        x=x+ chr(a)

print ('String after encrption: ', x)

Comments

Some popular posts

Python Program that computes the net amount of a bank account based a transaction log from console input.