Python Forum
how to decode this in python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to decode this in python
#11
You have the code
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.
Reply


Messages In This Thread
how to decode this in python - by anthoniegallego - Apr-07-2019, 07:39 PM
RE: how to decode this in python - by Yoriz - Apr-07-2019, 08:00 PM
RE: how to decode this in python - by Yoriz - Apr-07-2019, 08:12 PM
RE: how to decode this in python - by Yoriz - Apr-07-2019, 08:15 PM
RE: how to decode this in python - by ichabod801 - Apr-07-2019, 08:17 PM
RE: how to decode this in python - by Yoriz - Apr-07-2019, 08:21 PM
RE: how to decode this in python - by Yoriz - Apr-07-2019, 08:30 PM
RE: how to decode this in python - by loomski - Apr-08-2019, 08:45 PM
RE: how to decode this in python - by Yoriz - Apr-07-2019, 09:06 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020