I am beginner to python and programming in general. As I am learning python, I am tying to develop a good habit or follow a good practice. So let me first explain what I am currently doing.
I use Emacs (prelude) to execute python scripts. The keybinding C-c C-c evaluates the buffer which contains the python script. Then I get a new buffer with a python interpreter with >>> prompt. In this environment all the variables used in the scripts are accessible. For example, if x and y were defined in the script, I can do >>> x + y to evaluate it. 
I see many people (if not most) around me using command line to execute the python script (i.e., $ python scriptname.py). If I do this, then I return to the shell prompt, and I am not able to access the variables x and y to perform x + y. So I wasn't sure what the advantage of running python scripts using the command line. 
Should I just use Emacs as a editor and use Terminal (I am using Mac) to execute the script? What is a better practice?
Thank you!
People use different tools for different purposes. 
An important question about the interface into any program is who is the user? You, as a programmer, will use the interpreter to test a program and check for errors. Often times, the user doesn't really need to access the variables inside because they are not interacting with the application/script with an interpreter. For example, with Python web applications, there is usually a main.py script to redirect client HTTP requests to appropriate handlers. These handlers execute a python script automatically when a client requests it. That output is then displayed to the user. In Python web applications, unless you are the developer trying to eliminate a bug in the program, you usually don't care about accessing variables within a file like main.py (in fact, giving the client access to those variables would pose a security issue in some cases). Since you only need the output of a script, you'd execute that script function in command line and display the result to the client.
About best practices: again, depends on what you are doing.
Using the python interpreter for computation is okay for smaller testing of isolated functions but it doesn't work for larger projects where there are more moving parts in a python script. If you have a python script reaching a few hundred lines, you won't really remember or need to remember variable names. In that case, it's better to execute the script in command-line, since you don't need access to the internal components. 
You want to create a new script file if you are fashioning that script for a single set of tasks. For example with the handlers example above, the functions in main.py are all geared towards handling HTTP requests. For something like defining x, defining y, and then adding it, you don't really need your own file since you aren't creating a function that you might need in the future and adding two numbers is a built-in method. However, say you have a bunch of functions you've created that aren't available in a built-in method (complicated example: softmax function to reduce K dimension vector to another K dimension vector where every element is a value between 0 and 1 and all the elements sum to 1), you want to capture in a script file and cite that script's procedure later. In that case, you'd create your own script file and cite it in a different python script to execute.
What is the advantage of running python script using command line?