Apr-07-2019, 07:39 PM
hi, im fairly new to python and i was wondering how i could finish this 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 def decode_text (text): dec_text = '' # Add code to decode the message that was encoded wint enccode_text (text) function return dec_textthe code above would be imported into the following:
import enc_function text = 'Uie!svjdl!drqwo fqy"lwmqs"oxfs"tif!ncz{!eqh' print ("Original string: ", enc_function.decode_text (text))