Is it possible that I can hide part of my code and other can't see but it runs?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is it possible that I can hide part of my code and other can't see but it runs??

For example I want to hide this code Print("hello") but I can see hello in teminal Thanks

7th Sep 2021, 6:46 PM
A.R.T
A.R.T - avatar
2 Answers
0
A.R.T No it's not possible.
7th Sep 2021, 6:50 PM
A͢J
A͢J - avatar
0
Well that depends... You want to hide the ‘code’ but say you can see hello in the terminal. That’s because you are printing the output to the terminal. If you were to run: (“hello") or str = “hello” That would not be seen in the terminal. So if it’s hiding terminal output you mean, don’t use print. If you mean hiding the code to distribute, this is very difficult with Python being an interpreted language. You can convert to bytecode, but that’s easily reveresed. You can compile to an exe (using libraries like freeze, py2exe etc). However this comes with the downside that the python interpreter has to be included to run, usually creates large executables and slow program startup times. Even this can be reversed pretty easy. The other alternative is obfuscation, but again there are ways and means of reversing. Python is not a good choice for concealed source distribution.
7th Sep 2021, 7:34 PM
DavX
DavX - avatar