I am a beginner so if this question sounds stupid, please bear with me.
I am wondering that when we write code for username/password check in python, if it is not c
To protect data stored on the client machine, you have to encrypt it. Period.
If you trust an authorized user, you can use a password-based encryption key (many other answers on Stack Exchange address this), and hope that he is smart enough to protect his computer from malware.
If you don't trust the authorized user (a.k.a. DRM) you are just plain out of luck -- find another project.;-)