hi i have to write pyhton code for the program below..i have tried doin it but could not get the desired result so if anyone can help me out i would be very thankful.the question is as below..
A Caesar cipher is a simple substitution cipher based on the idea of shifting
each character in a message a fixed number of positions in the alphabet (the
fixed number is called the key). For example “apple” would become “bqqmf”
with a key of 1, and the initial message could be recovered using a key of -1.
Write a program program which encodes a text file using the Caesar cipher
and output the result to a file of the same name with a “.xxx” appended to it.
Your program will need to prompt the user for the name of the text file
containing the initial message and the key to be used.
You will need to use the chr() function to solve this problem. For example if
you wanted to shift a character (lets call it ch) 2 places you could do so in
Python with chr(ord(ch)+2).
Finally modify your Caesar cipher to use two separate keys. The first key
would shift every odd numbered character and the second key every even numbered character.
Above is the question what i have to do it is only a single question
A Caesar cipher is a simple substitution cipher based on the idea of shifting
each character in a message a fixed number of positions in the alphabet (the
fixed number is called the key). For example “apple” would become “bqqmf”
with a key of 1, and the initial message could be recovered using a key of -1.
Write a program program which encodes a text file using the Caesar cipher
and output the result to a file of the same name with a “.xxx” appended to it.
Your program will need to prompt the user for the name of the text file
containing the initial message and the key to be used.
You will need to use the chr() function to solve this problem. For example if
you wanted to shift a character (lets call it ch) 2 places you could do so in
Python with chr(ord(ch)+2).
Finally modify your Caesar cipher to use two separate keys. The first key
would shift every odd numbered character and the second key every even numbered character.
Above is the question what i have to do it is only a single question
Comment