Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Decrypted message two successfully
  • Loading branch information
haa19018 committed Jan 29, 2024
1 parent 8847839 commit e406861
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion decrypt_message_two.py
Expand Up @@ -4,4 +4,22 @@ encrypted_message = encrypted_file.readline()

encrypted_file.close()

# Write Code Here
# Write Code Here

length = len(encrypted_message)
decrypted_message = list(encrypted_message) # list conversion

""" Swap characters """
start = 1
end = length - 2

while start < end:
decrypted_message[start], decrypted_message[end] = decrypted_message[end], decrypted_message[start]

start += 2
end -= 2

# reconvert back to string
decrypted_message = ''.join(decrypted_message)

print("Decrypted Message:", decrypted_message)

0 comments on commit e406861

Please sign in to comment.