Expand|Select|Wrap|Line Numbers
- def decrypt(ciphertext, shift):
- decrytped_text = " "
- for letter in ciphertext:
- if letter.isalpha():
- num = ord(letter)
- num += key
- if letter.isupper():
- if num > ord('Z'):
- num -= 26
- elif num < ord ('A'):
- num += 26
- elif letter.islower():
- if num > ord('z'):
- num -= 26
- elif num < ord('a'):
- num +=26
- decrypted_text += chr(num)
- else:
- decrypted_text += letter
- return decrypted_text
- print 'Decryted text is : '
- print decrypt(ciphertext, shift)
now when i run this program it says shift and ciphertext are not defined. I understand that they aren't defined im just having difficulty in knowing where and how to define these to parameters so that my program works.
If you coul help or point me in the right direction that would be great.
Thanks
oh and heres what im testing it on :
decrypt('bcdefghijklmnopqrstuvwxyza', 1)
'abcdefghijklmnopqrstuvwxyz'
very simple i know, but im a n00b at python :)
any help would be greatly appreciated.