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 compiled to exe ie script state, won't people will easily open the file and remove the code potion that is doing the password check?
I am assuming that the whole program is entirely written in python, no C or C++.
Even if I use a program like py2exe it can be easily decompiled back to source code. So, does that mean it is useless to do a password check?
How do professional programmers cope with that?
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.;-)
Python Password Protection