keyword encryption challenge of python

chinggltc

Estimable
Jan 24, 2016
1
0
4,510
Hey can anyone help me to solve this question ? I've been doing this for a month but still can't find any solution
A more secure method of encryption would be to use a keyword. A keyword is the information needed in order to transform the plaintext into the encrypted message and is also used by the recipient to decrypt the message. For example, a keyword could be the letters GCSE. The keyword is repeated enough times to match the length of the plaintext message. The alphabet value (position of the letter in the alphabet) of each letter of the key phrase is added to the alphabet value of each letter of the plaintext message to generate the encrypted text.
For example, if we use the keyword GCSE then we make up the key phrase for COMPUTINGISFUN by repeating the letters within GCSE to make a 14 letter code, GCSEGCSEGCSEGC, where G is the 7th letter of the alphabet, C the 3rd, S the 19th and E the 5th.

here's my code
x=input("Please enter your keyword: ")
y=input("Please enter your message: ")


def keyword(x,y):
letter=' ABCDEFGHIJKLMNOPQRSTUVWXYZ'
if x.isupper():
for c in x:
x=letter.index(c)
if y.isupper():
for c in y:
y=letter.index(c)
z= x + y
print(z)
else:
print("lower case letter not available")

else:
print("lower case letter not available")

keyword(x,y)