# This program performs a basic rotation cipher, # shifting each character in a string by a given amount. # Returns a rotation cipher of s, shifting each letter in the string # by the given number of positions in the alphabet. # pre: s consists entirely of lowercase letters from a-z # pre: -26 <= amount <= 26 def encode(s, amount): result = "" for letter in s: num = ord(letter) + amount # shift letter if num > ord('z'): # wrap around if needed num -= 26 elif num < ord('a'): num += 26 result += chr(num) return result def main(): message = "hello" secret = encode("hello", 3) print("Your secret message is:", secret) main()