substitution0

This commit is contained in:
Maxime Vorwerk
2024-06-09 15:01:43 +02:00
parent 584e1cef2d
commit 6a5a7c3aef
2 changed files with 30 additions and 0 deletions

18
substitution0/sol.py Executable file
View File

@@ -0,0 +1,18 @@
#!/home/maxime/.pyvenv/bin/python3
key = "OHNFUMWSVZLXEGCPTAJDYIRKQB"
D = {}
for i, char in enumerate(key):
D[char] = chr(ord('A') + i)
D[char.lower()] = chr(ord('a') + i)
with open("message.txt", 'r') as f:
for char in f.read():
if char in D:
print(D[char], end='')
else:
print(char, end='')
print()