This is a simple challenge. Given an encrypted sentence, decrypt that sentence.
Only alphabetical characters are included, except for spaces. Spaces are not altered.
def cipher_breaker(string: str):
final_list = []
for each in string:
if each != " ":
each = chr(123 - (ord(each) - 96))
final_list.append(each)
return "".join(final_list)
# TODO: Replace examples and use TDD development by writing your own tests
# These are some of the methods available:
# test.expect(boolean, [optional] message)
# test.assert_equals(actual, expected, [optional] message)
# test.assert_not_equals(actual, expected, [optional] message)
# You can use Test.describe and Test.it to write BDD style test groupings
test.assert_equals(cipher_breaker("xlmtizgfozgrlmh blf ziv zg ovzhg hlig lu hnzig"),"congratulations you are at least sort of smart", "is that all?")