Programming in Python; writing a Caesar Cipher using a zip() method
- by user1068153
I'm working on a python program for homework and the problem asks me to develop a program that encrypts a message using a caesar cipher. I need to be able to have the user input a number to shift the encryption by, such as 4: e.g. 'A' to 'E'. The user also needs to input the string to be translated. The book says to use a zip() to do the problem. I am confused on how I would do this though.
I have this but it doesn't do anything
>>>def ceasarCipher(string, shift):
strings = ['abc', 'def']
shifts = [2,3]
for string, shift in zip(strings, shifts):
print ceasarCipher(string,shift)
>>>string = 'hello world'
>>>shift = 1