categories: computer science
Hello everyone,
Below you will find a video with a detailed explanation of the algorithm for the Caesar cipher. Its operation, time complexity, and usefulness. Below you will also find ready-to-use code that you can copy if needed.
Code:
slowo = "abcdefghijklmn"
klucz = 16 % 26
def zaszyfruj(slowo, klucz):
zaszyfrowane = ""
for i in slowo:
if chr(ord(i) + klucz) > 'z':
zaszyfrowane += chr(ord(i) + klucz - 26)
else:
zaszyfrowane += chr(ord(i) + klucz)
return zaszyfrowane
print(zaszyfruj(slowo, klucz))
Video:
Thank you for reading!
Read more