Ask coding questions

← Back to all posts
Can anyone help me convert my decoding to work just like my encoding
JamesGordon1 (129)

I want to make the decoding "live" as well so that it works just like the encoding part but I have no idea how to even start to do this, I want it to print in two lines one showing the raw text and then the decoded text and have it print out the text until it has a valid code then decode it kinda like this:

Base text: 2
Decoded text: h

Base text: 25
Decoded text: he

Base text: 25-
Decoded text: hel

Base text: 25--
Decoded text: hell

Base text: 25--(
Decoded text: hell(

Base text: 25--(8
Decoded text: hell(8

Base text: 25--(8)
Decoded text: hello


you can do it the same as encoding process.

Brendan23 (137)

@JamesGordon1 tell me if this is what you want. first, you will have to move your print statement that prints the decoded message bellow line 118 and add it again bellow line 121. then, bellow those newly added print statements, addprint('\033[H', end=""), and bellow that add sleep(any integer can be put here) if you don't understand or it doesn't work, please tell me.

JamesGordon1 (129)

@Brendan23 no its not that simple, I need to recode the entire decoding process to use getch instead of input