Apr-07-2019, 09:06 PM
You have the code
Once you understand what this is doing you can alter this code to the reverse of what it doing.
import random def encode_text (text): random.seed (0) enc_text = '' for ch in text: enc_number = random.randint (0, 2) enc_char = chr(ord (ch) + enc_number) enc_text += enc_char return enc_text print(encode_text('test'))
Output:ufsu
Study it figure out what it is doing look up commands you don't know in the documents, add print statements in to see what is happening at different stages in the code.Once you understand what this is doing you can alter this code to the reverse of what it doing.