mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-10-06 05:39:30 +00:00
Compare commits
4 Commits
c71296e5fc
...
db2af17ccd
Author | SHA1 | Date | |
---|---|---|---|
|
db2af17ccd | ||
|
1d944f6f43 | ||
|
4fe7d3d8b5 | ||
|
4d35248172 |
|
@ -1,3 +1,11 @@
|
|||
"""
|
||||
|
||||
Note:
|
||||
This algorithm has memory persistence.
|
||||
So multiple runs on the same runtime will carry junk and scramble the result!
|
||||
"""
|
||||
|
||||
|
||||
alphabets = [chr(i) for i in range(32, 126)]
|
||||
gear_one = list(range(len(alphabets)))
|
||||
gear_two = list(range(len(alphabets)))
|
||||
|
@ -40,7 +48,22 @@ def engine(input_character):
|
|||
rotator()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
def encode_or_decode(message, token):
|
||||
"""
|
||||
|
||||
>>> encode_or_decode("hello", 3)
|
||||
(['/', '0', "'", '%', ' '], 3)
|
||||
|
||||
"""
|
||||
|
||||
for _ in range(token):
|
||||
rotator()
|
||||
for j in message:
|
||||
engine(j)
|
||||
return code, token
|
||||
|
||||
|
||||
def menu():
|
||||
decode = list(input("Type your message:\n"))
|
||||
while True:
|
||||
try:
|
||||
|
@ -57,3 +80,9 @@ if __name__ == "__main__":
|
|||
f"\nYour Token is {token} please write it down.\nIf you want to decode "
|
||||
"this message again you should input same digits as token!"
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import doctest
|
||||
|
||||
doctest.testmod()
|
||||
|
|
Loading…
Reference in New Issue
Block a user